@mozilla-ai/mcpd 0.1.0 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -19
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -233,6 +233,18 @@ Returns tool schemas for a specific server.
|
|
|
233
233
|
// Get tools for a specific server
|
|
234
234
|
const timeTools = await client.servers.time.getTools();
|
|
235
235
|
// Returns: [{ name: 'get_current_time', description: '...', inputSchema: {...} }]
|
|
236
|
+
|
|
237
|
+
// Iterate over tools
|
|
238
|
+
for (const tool of timeTools) {
|
|
239
|
+
console.log(`${tool.name}: ${tool.description}`);
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
// Works with dynamic server names
|
|
243
|
+
const servers = await client.listServers();
|
|
244
|
+
for (const serverName of servers) {
|
|
245
|
+
const tools = await client.servers[serverName].getTools();
|
|
246
|
+
console.log(`${serverName}: ${tools.length} tools`);
|
|
247
|
+
}
|
|
236
248
|
```
|
|
237
249
|
|
|
238
250
|
#### `client.servers.<server>.tools.<tool>(args)`
|
|
@@ -250,25 +262,6 @@ const result = await client.servers.weather.tools.get_forecast({
|
|
|
250
262
|
const time = await client.servers.time.tools.get_current_time();
|
|
251
263
|
```
|
|
252
264
|
|
|
253
|
-
#### `client.servers.<server>.getTools()`
|
|
254
|
-
|
|
255
|
-
Get all tools available on a specific server.
|
|
256
|
-
|
|
257
|
-
```typescript
|
|
258
|
-
// List tools for a server using property access
|
|
259
|
-
const tools = await client.servers.time.getTools();
|
|
260
|
-
for (const tool of tools) {
|
|
261
|
-
console.log(`${tool.name}: ${tool.description}`);
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
// Useful in loops with dynamic server names
|
|
265
|
-
const servers = await client.listServers();
|
|
266
|
-
for (const serverName of servers) {
|
|
267
|
-
const tools = await client.servers[serverName].getTools();
|
|
268
|
-
console.log(`${serverName}: ${tools.length} tools`);
|
|
269
|
-
}
|
|
270
|
-
```
|
|
271
|
-
|
|
272
265
|
#### `client.servers.<server>.callTool(toolName, args?)`
|
|
273
266
|
|
|
274
267
|
Call a tool by name with the given arguments. This is useful for programmatic tool invocation when the tool name is in a variable.
|