Commit 1a03d62
committed
mcp: example middleware wrapping ToolHandler
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.1 parent 62db914 commit 1a03d62
1 file changed
+6
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
43 | 49 | | |
44 | 50 | | |
45 | | - | |
46 | 51 | | |
47 | | - | |
48 | 52 | | |
49 | | - | |
50 | 53 | | |
51 | 54 | | |
52 | 55 | | |
| |||
62 | 65 | | |
63 | 66 | | |
64 | 67 | | |
65 | | - | |
66 | 68 | | |
67 | 69 | | |
68 | 70 | | |
| |||
0 commit comments