| 1 | package agent |
| 2 | |
| 3 | import ( |
| 4 | "context" |
| 5 | "fmt" |
| 6 | "reasonix/internal/plugin" |
| 7 | ) |
| 8 | |
| 9 | // listServerTools renders the live tool directory of a connected server and |
| 10 | // refreshes the proxy snapshot on the way (via serverTools). |
| 11 | func (t *UseCapabilityTool) listServerTools(ctx context.Context, server string) (string, error) { |
| 12 | tools, err := t.serverTools(ctx, server) |
| 13 | if err != nil { |
| 14 | return "", err |
| 15 | } |
| 16 | return fmt.Sprintf("connected MCP server %q; %d tools:\n%s", server, len(tools), inspectToolListJSON(server, tools)), nil |
| 17 | } |
| 18 | |
| 19 | func (t *UseCapabilityTool) listServerToolsForSpec(ctx context.Context, server string, spec plugin.Spec) (string, error) { |
| 20 | tools, err := t.serverToolsForSpec(ctx, server, spec) |
| 21 | if err != nil { |
| 22 | return "", err |
| 23 | } |
| 24 | return fmt.Sprintf("connected MCP server %q; %d tools:\n%s", server, len(tools), inspectToolListJSON(server, tools)), nil |
| 25 | } |
| 26 |