-
Notifications
You must be signed in to change notification settings - Fork 28
Add MCP tools JSON schema validation test #4282
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds comprehensive schema validation for the tools.json file against the Model Context Protocol (MCP) specification. The changes ensure that the safe outputs tools conform to the MCP standard through automated testing.
Key Changes
- Created an MCP tools JSON schema file defining the structure for MCP tool arrays with required and optional fields
- Added three comprehensive test functions that validate tools.json against the MCP schema using different validation approaches
- All tests validate the structure and compliance of 12 safe output tools
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| pkg/workflow/schemas/mcp-tools.json | New JSON schema file defining MCP tools specification with required fields (name, inputSchema) and optional fields (title, description, outputSchema, annotations) |
| pkg/workflow/safe_outputs_tools_schema_test.go | New test file with three test functions validating tools.json against MCP schema using jsonschema validator and manual field validation |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| "title": { | ||
| "type": "string", | ||
| "description": "A human-readable title for the tool" | ||
| }, |
Copilot
AI
Nov 18, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The title field appears in both the Tool definition (line 19-22) and the ToolAnnotations definition (lines 101-104) with slightly different descriptions. This duplication is confusing. According to MCP specification, title should only be at the tool level (for UI display) or within annotations. Consider removing the duplicate or clarifying in the description that these are distinct fields for different purposes.
| "title": { | |
| "type": "string", | |
| "description": "A human-readable title for the tool" | |
| }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Clarified the descriptions in b6a4c74. Both title fields are valid per the MCP spec: the tool-level title is for UI display, while the annotations title is a hint. Updated descriptions to distinguish between them.
|
@copilot lint |
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Add test that validates tools.json against MCP tools JSON schema
Changes Made
Created MCP Tools JSON Schema:
pkg/workflow/schemas/mcp-tools.json(removed duplicate from rootschemas/)name,inputSchematitle,description,outputSchema,annotationstitlecan appear both at tool level and in annotations with different purposesCreated Comprehensive Tests:
TestSafeOutputsToolsJSONCompliesWithMCPSchema: Validates the entire tools.json file against the MCP schema using jsonschema validatorTestEachToolHasRequiredMCPFields: Validates each tool has the required MCP fields (name, inputSchema with proper structure)TestToolsJSONStructureMatchesMCPSpecification: Validates that tools don't have unexpected fields and follow MCP specificationAll Tests Pass:
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.