List Ducks
list_ducksList all LLM providers and their status. Optionally perform health checks to verify each provider is operational.
Instructions
List all available LLM providers (ducks) and their status
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| check_health | No | Perform health check on all providers |
Implementation Reference
- src/tools/list-ducks.ts:7-73 (handler)The main handler function for the list_ducks tool. It retrieves all providers, optionally checks their health, and formats a text response listing each duck with its status, type, model, endpoint details, and health info.
export async function listDucksTool( providerManager: ProviderManager, healthMonitor: HealthMonitor, args: Record<string, unknown> ) { const { check_health = false } = args as { check_health?: boolean; }; // Get all providers with their info const providers = providerManager.getAllProviders(); // Perform health check if requested let healthStatus = new Map<string, ProviderHealth>(); if (check_health) { const healthResults = await healthMonitor.performHealthChecks(); healthStatus = new Map(healthResults.map((result) => [result.provider, result])); } // Build response let response = `${duckArt.panel}\n\n`; response += `Found ${providers.length} duck(s) in the pond:\n\n`; for (const provider of providers) { const health = healthStatus.get(provider.name); const statusEmoji = health?.healthy ? 'ā ' : health === undefined ? 'ā' : 'ā'; const providerType = provider.info.type === 'cli' ? 'CLI' : 'HTTP'; response += `${statusEmoji} **${provider.info.nickname}** (${provider.name}) [${providerType}]\n`; response += ` š Model: ${provider.info.model}\n`; if (provider.info.type === 'cli') { response += ` š„ļø Command: ${provider.info.cliCommand || 'default'}\n`; response += ` š§ CLI Type: ${provider.info.cliType || 'unknown'}\n`; } else { response += ` š Endpoint: ${provider.info.baseURL}\n`; response += ` š API Key: ${provider.info.hasApiKey ? 'Configured' : 'Not required'}\n`; } if (health) { response += ` š Health: ${health.healthy ? 'Healthy' : 'Unhealthy'}`; if (health.latency) { response += ` (${health.latency}ms)`; } if (health.error) { response += `\n ā ļø Error: ${health.error}`; } response += `\n š Last check: ${health.lastCheck.toLocaleTimeString()}\n`; } response += '\n'; } // Add summary const healthyCount = Array.from(healthStatus.values()).filter((h) => h.healthy).length; response += `\nš Summary: ${healthyCount}/${providers.length} ducks are healthy and ready!`; logger.info(`Listed ${providers.length} ducks, ${healthyCount} healthy`); return { content: [ { type: 'text', text: response, }, ], }; } - src/server.ts:346-351 (schema)Input schema for list_ducks: optional boolean check_health parameter with default false.
inputSchema: { check_health: z .boolean() .default(false) .describe('Perform health check on all providers'), }, - src/server.ts:341-370 (registration)Registration of the 'list_ducks' tool with the MCP server, including title, description, input schema, annotations, and the handler invocation.
this.server.registerTool( 'list_ducks', { title: 'List Ducks', description: 'List all available LLM providers (ducks) and their status', inputSchema: { check_health: z .boolean() .default(false) .describe('Perform health check on all providers'), }, annotations: { readOnlyHint: true, openWorldHint: true, }, }, async (args) => { try { return this.toolResult( await listDucksTool( this.providerManager, this.healthMonitor, args as Record<string, unknown> ) ); } catch (error) { return this.toolErrorResult(error); } } ); - src/config/types.ts:231-237 (helper)The ProviderHealth interface used by list_ducks to type-check health status results.
export interface ProviderHealth { provider: string; healthy: boolean; latency?: number; lastCheck: Date; error?: string; }