CallTool locates the proxier to which the requested tool is associated and delegates the tool call to it.
(ctx context.Context, name string, input any)
| 105 | // CallTool locates the proxier to which the requested tool is associated and |
| 106 | // delegates the tool call to it. |
| 107 | func (s *ServerProxyManager) CallTool(ctx context.Context, name string, input any) (*mcp.CallToolResult, error) { |
| 108 | tool := s.GetTool(name) |
| 109 | if tool == nil { |
| 110 | return nil, xerrors.Errorf("%q tool not known", name) |
| 111 | } |
| 112 | |
| 113 | proxy, ok := s.proxiers[tool.ServerName] |
| 114 | if !ok { |
| 115 | return nil, xerrors.Errorf("%q server not known", tool.ServerName) |
| 116 | } |
| 117 | |
| 118 | return proxy.CallTool(ctx, name, input) |
| 119 | } |
| 120 | |
| 121 | // Shutdown concurrently shuts down all known proxiers and waits for them *all* to complete. |
| 122 | func (s *ServerProxyManager) Shutdown(ctx context.Context) error { |