Skip to content

Conversation

@jba
Copy link
Contributor

@jba jba commented Aug 19, 2025

WIP
Description TBD.

@jba jba requested review from findleyr and samthanawalla August 19, 2025 16:29
v2

fixed more tests

unexport ToolFor

fix some tests
@jba jba enabled auto-merge (squash) August 20, 2025 21:10
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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: preexisting: just inline into the literal below.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand.

})
}
}
// func TestMCPServerIntegration(t *testing.T) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please explain what specifically is broken about this. I can fix as soon as you land this.

@jba jba merged commit 32cf71d into modelcontextprotocol:main Aug 20, 2025
6 checks passed
jba added a commit that referenced this pull request Aug 21, 2025
@andig
Copy link

andig commented Aug 22, 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 mcp.Tool.

@findleyr
Copy link
Contributor

@andig the right issue is #302.

The motivation is that in the common case, you only need to access the args, and also want access to the actual incoming params. I agree that the Out parameter is somewhat awkward, but once you get used to it it is also convenient.

@findleyr
Copy link
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants