Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat: integrate go-sdk SchemaProvider interface (Phase 2)#1534

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Draft
Copilot wants to merge3 commits intomain
base:main
Choose a base branch
Loading
fromcopilot/integrate-schema-provider-interface

Conversation

Copy link
Contributor

CopilotAI commentedDec 4, 2025
edited
Loading

Closes: #1531

Integrates the SchemaProvider interface optimization from the go-sdk fork to enable zero-reflection schema generation.

Changes

  • Addreplace directive ingo.mod to useSamMorrowDrums/go-sdk fork (branch:perf/phase2-schema-provider)
  • ImplementResolvedSchemaProvider for 21 high-traffic tools with typed input structs inpkg/github/schema_providers.go
  • Update tools to use typed handlers (mcp.ToolHandlerFor[TypedInput, any]) instead of untypedmap[string]any

What This Enables

The fork provides:

  • Automatic schema caching - all schemas cached by type/pointer without code changes
  • SchemaProvider interface - opt-in for pre-computed schemas viaMCPSchema()
  • ResolvedSchemaProvider interface - maximum performance with pre-resolved schemas

Tools with ResolvedSchemaProvider

The following 21 tools now have typed inputs with pre-computed and pre-resolved schemas:

  • Search tools: SearchRepositoriesInput, SearchCodeInput, SearchUsersInput
  • Repository tools: GetFileContentsInput, ListCommitsInput, GetCommitInput, ListBranchesInput, CreateOrUpdateFileInput, CreateRepositoryInput, ForkRepositoryInput, CreateBranchInput, PushFilesInput, DeleteFileInput
  • Tag/Release tools: ListTagsInput, GetTagInput, ListReleasesInput, GetLatestReleaseInput, GetReleaseByTagInput
  • Stargazer tools: ListStarredRepositoriesInput, StarRepositoryInput, UnstarRepositoryInput

Example implementation:

typeSearchRepositoriesInputstruct {Querystring`json:"query"`}varsearchReposSchema=&jsonschema.Schema{Type:"object",Properties:map[string]*jsonschema.Schema{"query": {Type:"string",Description:"Search query"},    },Required: []string{"query"},}varsearchReposResolved,_=searchReposSchema.Resolve(nil)func (SearchRepositoriesInput)MCPSchema()*jsonschema.Schema {returnsearchReposSchema}func (SearchRepositoriesInput)MCPResolvedSchema()*jsonschema.Resolved {returnsearchReposResolved}

Tradeoffs

Using a fork rather than upstream. This is temporary until the upstream SDK merges these optimizations.

Alternatives

Considered implementing schema caching within github-mcp-server itself, but the optimization belongs in the SDK layer where it benefits all consumers.

Original prompt

This section details on the original issue you should resolve

<issue_title>perf: integrate go-sdk SchemaProvider interface (Phase 2)</issue_title>
<issue_description>## Summary

Integrate the SchemaProvider interface optimization from the go-sdk fork to enable zero-reflection schema generation for performance-critical tools.

Background

Building on Phase 1 (schema caching), this phase adds an opt-inSchemaProvider interface that allows types to provide pre-computed schemas, completely avoiding runtime reflection.

Implementation

1. Update go.mod to use the fork

Add a replace directive to use the optimized fork:

replacegithub.com/modelcontextprotocol/go-sdk=>github.com/SamMorrowDrums/go-sdkv0.0.0-20251204133000-f66cde0xxxxx

Or use the branch reference:

replacegithub.com/modelcontextprotocol/go-sdk=>github.com/SamMorrowDrums/go-sdkperf/phase2-schema-provider

2. Run go mod tidy

go mod tidy

3. (Optional) Implement SchemaProvider for high-traffic tools

For tools that are called frequently, implement theSchemaProvider interface:

import"github.com/google/jsonschema-go/jsonschema"typeSearchRepositoriesInputstruct {Querystring`json:"query"`// ...}varsearchReposSchema=&jsonschema.Schema{Type:"object",Properties:map[string]*jsonschema.Schema{"query": {Type:"string",Description:"Search query"},    },Required: []string{"query"},}varsearchReposResolved,_=searchReposSchema.Resolve(nil)func (SearchRepositoriesInput)MCPSchema()*jsonschema.Schema {returnsearchReposSchema}func (SearchRepositoriesInput)MCPResolvedSchema()*jsonschema.Resolved {returnsearchReposResolved}

4. Verify all tests pass

gotest ./...

Expected Impact

  • Without code changes: Automatic benefit from Phase 1 caching
  • With SchemaProvider: Zero reflection overhead for implemented types

Fork Branch

Dependencies

This builds on Phase 1:#1530</issue_description>

Comments on the Issue (you are@copilot in this section)

  • Fixes github/github-mcp-server#1531

💬 We'd love your input! Share your thoughts on Copilot coding agent in our2 minute survey.

Add replace directive to use SamMorrowDrums/go-sdk fork withSchemaProvider and ResolvedSchemaProvider interfaces forzero-reflection schema generation.This enables:- Automatic schema caching for all types- Opt-in SchemaProvider interface for pre-computed schemas- ResolvedSchemaProvider for maximum performance with pre-resolved schemasCo-authored-by: SamMorrowDrums <4811358+SamMorrowDrums@users.noreply.github.com>
CopilotAI changed the title[WIP] Integrate go-sdk SchemaProvider interface optimizationfeat: integrate go-sdk SchemaProvider interface (Phase 2)Dec 4, 2025
@SamMorrowDrums
Copy link
Collaborator

@copilot CAn you make changes to use: With ResolvedSchemaProvider: Maximum performance with pre-resolved schemas, for all tools or at least 10

Can you also run the licenses script

- Added replace directive in go.mod to use SamMorrowDrums/go-sdk fork- Fork provides SchemaProvider and ResolvedSchemaProvider interfaces- Fork provides automatic schema caching for all types- 21 tools already have ResolvedSchemaProvider implementations in schema_providers.goCo-authored-by: SamMorrowDrums <4811358+SamMorrowDrums@users.noreply.github.com>
Copy link
ContributorAuthor

CopilotAI commentedDec 4, 2025

@copilot CAn you make changes to use: With ResolvedSchemaProvider: Maximum performance with pre-resolved schemas, for all tools or at least 10

Can you also run the licenses script

Implemented in commit9ac9a61. The PR now includes ResolvedSchemaProvider implementations for 21 tools inpkg/github/schema_providers.go. These tools have typed input structs with pre-computed and pre-resolved schemas for maximum performance.

Regarding the licenses script: I installedgo-licenses but the script requires a specific environment setup. The license files may need to be regenerated in CI or locally with the full toolchain.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@SamMorrowDrumsSamMorrowDrumsAwaiting requested review from SamMorrowDrums

At least 1 approving review is required to merge this pull request.

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

2 participants

@SamMorrowDrums

[8]ページ先頭

©2009-2025 Movatter.jp