feat: Add output schema to select readonly tools under opt-in feature flag#2468
Open
RossTarrant wants to merge 3 commits into
Open
feat: Add output schema to select readonly tools under opt-in feature flag#2468RossTarrant wants to merge 3 commits into
RossTarrant wants to merge 3 commits into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds opt-in MCP outputSchema support for selected read-only GitHub tools, with matching gated structuredContent responses while preserving legacy text responses.
Changes:
- Adds
output_schemasfeature flag plumbing and registration-time output schema attachment. - Introduces schema inference/result helpers plus minimal response wrapper types.
- Adds structured outputs for selected context, issue, label, PR, repository, release, and search tools, with tests and toolsnap normalization updates.
Show a summary per file
| File | Description |
|---|---|
pkg/inventory/server_tool.go |
Adds OutputSchema, registration options, and gated schema attachment. |
pkg/inventory/registry.go |
Enables output schema registration based on feature flag. |
pkg/inventory/registry_test.go |
Tests feature-gated registration behavior. |
pkg/inventory/builder.go |
Adds inventory-side output schema feature flag constant. |
pkg/http/middleware/cors.go |
Adds a new allowed CORS request header. |
pkg/github/tools_validation_test.go |
Validates expected tools have gated output schemas. |
pkg/github/search.go |
Adds structured outputs/schemas to search tools. |
pkg/github/search_utils.go |
Passes dependencies to shared search handler for feature-gated structured output. |
pkg/github/repositories.go |
Adds structured outputs/schemas to selected repository/release tools. |
pkg/github/pullrequests.go |
Adds structured outputs/schemas to PR listing/search tools. |
pkg/github/output_schema.go |
Adds output schema inference and structured text result helpers. |
pkg/github/output_schema_test.go |
Tests schema inference and structured content gating. |
pkg/github/minimal_types.go |
Adds minimal response wrapper/result types and converters. |
pkg/github/labels.go |
Adds structured output/schema for get_label. |
pkg/github/issues.go |
Adds structured outputs/schemas to selected issue tools. |
pkg/github/feature_flags.go |
Adds output_schemas to allowed feature flags. |
pkg/github/feature_flags_test.go |
Tests explicit output schema feature resolution. |
pkg/github/context_tools.go |
Adds structured outputs/schemas to selected context tools. |
internal/toolsnaps/toolsnaps.go |
Normalizes snapshots and strips gated outputSchema. |
internal/toolsnaps/toolsnaps_test.go |
Tests output schema stripping in toolsnap normalization. |
Copilot's findings
- Files reviewed: 20/20 changed files
- Comments generated: 2
| // A shallow copy of the tool is made to avoid mutating the original ServerTool. | ||
| // Panics if the tool has no handler - all tools should have handlers. | ||
| func (st *ServerTool) RegisterFunc(s *mcp.Server, deps any) { | ||
| st.RegisterFuncWithOptions(s, deps, RegisterToolOptions{}) |
| "Mcp-Session-Id", | ||
| "Mcp-Protocol-Version", | ||
| "Last-Event-ID", | ||
| "X-Custom-Auth-Headers", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds feature-gated MCP
outputSchemafor selected read-only tools.Why
Output schemas allow LLMs to anticipate the response from a tool. This proves useful to Code Mode, which needs machine-readable MCP responses for multi-step workflows.
What changed
output_schemasfeature flag and inventory registration support for gated tool output schemas.contentresponses for back-compat when structured output is enabled.MCP impact
output_schemasis enabled, selected tools includeoutputSchemain tool definitions and return matchingstructuredContent.Prompts tested (tool changes only)
Security / limits
Tool renaming
deprecated_tool_aliases.goLint & tests
./script/lint./script/testDocs