Skip to content

Conversation

@jba
Copy link
Contributor

@jba jba commented Aug 22, 2025

Add to the middleware example to show how to wrap a ToolHandler.

This middleware is very close to, but not the same as, wrapping a ToolHandler directly. The only difference is that the middleware wraps Server.callTool, which looks up the tool by name in the server's list and then calls the handler. That lookup (plus other intervening middleware, of course) is all that distinguishes this way of wrapping from a more direct wrapping.

Add to the middleware example to show how to wrap a ToolHandler.

This middleware is very close to, but not the same as, wrapping a
ToolHandler directly. The only difference is that the middleware wraps
Server.callTool, which looks up the tool by name in the server's list
and then calls the handler. That lookup (plus other intervening
middleware, of course) is all that distinguishes this way of wrapping
from a more direct wrapping.
@jba jba requested review from findleyr and samthanawalla August 22, 2025 11:56
@jba jba merged commit b891d95 into modelcontextprotocol:main Aug 22, 2025
5 checks passed
yasomaru pushed a commit to yasomaru/go-sdk that referenced this pull request Aug 28, 2025
Add to the middleware example to show how to wrap a ToolHandler.

This middleware is very close to, but not the same as, wrapping a
ToolHandler directly. The only difference is that the middleware wraps
Server.callTool, which looks up the tool by name in the server's list
and then calls the handler. That lookup (plus other intervening
middleware, of course) is all that distinguishes this way of wrapping
from a more direct wrapping.
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.

2 participants