Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 12 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,18 @@ Returns tool schemas for a specific server.
// Get tools for a specific server
const timeTools = await client.servers.time.getTools();
// Returns: [{ name: 'get_current_time', description: '...', inputSchema: {...} }]

// Iterate over tools
for (const tool of timeTools) {
console.log(`${tool.name}: ${tool.description}`);
}

// Works with dynamic server names
const servers = await client.listServers();
for (const serverName of servers) {
const tools = await client.servers[serverName].getTools();
console.log(`${serverName}: ${tools.length} tools`);
}
```

#### `client.servers.<server>.tools.<tool>(args)`
Expand All @@ -250,25 +262,6 @@ const result = await client.servers.weather.tools.get_forecast({
const time = await client.servers.time.tools.get_current_time();
```

#### `client.servers.<server>.getTools()`

Get all tools available on a specific server.

```typescript
// List tools for a server using property access
const tools = await client.servers.time.getTools();
for (const tool of tools) {
console.log(`${tool.name}: ${tool.description}`);
}

// Useful in loops with dynamic server names
const servers = await client.listServers();
for (const serverName of servers) {
const tools = await client.servers[serverName].getTools();
console.log(`${serverName}: ${tools.length} tools`);
}
```

#### `client.servers.<server>.callTool(toolName, args?)`

Call a tool by name with the given arguments. This is useful for programmatic tool invocation when the tool name is in a variable.
Expand Down