mcp: change tool handler design#325
Merged
jba merged 3 commits intomodelcontextprotocol:mainfrom Aug 20, 2025
Merged
Conversation
findleyr
reviewed
Aug 19, 2025
v2 fixed more tests unexport ToolFor fix some tests
findleyr
approved these changes
Aug 20, 2025
| func (k knowledgeBase) DeleteObservations(ctx context.Context, req *mcp.ServerRequest[*mcp.CallToolParamsFor[DeleteObservationsArgs]]) (*mcp.CallToolResultFor[struct{}], error) { | ||
| var res mcp.CallToolResultFor[struct{}] | ||
| func (k knowledgeBase) DeleteObservations(ctx context.Context, req *mcp.ServerRequest[*mcp.CallToolParams], args DeleteObservationsArgs) (*mcp.CallToolResult, struct{}, error) { | ||
| var res mcp.CallToolResult |
Contributor
There was a problem hiding this comment.
Nit: preexisting: just inline into the literal below.
| }) | ||
| } | ||
| } | ||
| // func TestMCPServerIntegration(t *testing.T) { |
Contributor
There was a problem hiding this comment.
Please explain what specifically is broken about this. I can fix as soon as you land this.
This was referenced Aug 21, 2025
This was referenced Aug 21, 2025
|
Not sure if I'm commenting on the right PR and fwiw, but I've had some trouble understanding the API changes. It seems kinda clumsy now having to specify input and output types both for tool handlers when those are never ever used and/or input and output schemas have already been defined as part of the |
Contributor
Contributor
|
Sorry, the issue is #327 |
yasomaru
pushed a commit
to yasomaru/go-sdk
that referenced
this pull request
Aug 28, 2025
Change the design of tool handlers by removing genericity from the common path. - `ToolHandler` gets the args as a `json.RawMessage`. Using Server.AddTool does no unmarshaling or schema validation. - `ToolHandlerFor`, installed with `AddTool`, are the only generic pieces. TODO: uncomment and fix some tests
yasomaru
pushed a commit
to yasomaru/go-sdk
that referenced
this pull request
Aug 28, 2025
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.
WIP
Description TBD.