harvest_list_clients
Retrieve and filter client information from Harvest time tracking system to manage business relationships and project organization.
Instructions
List all clients with filtering options. Use about {"tool": "harvest_list_clients"} for detailed parameters and examples.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| is_active | No | Filter by active status | |
| page | No | Page number | |
| per_page | No | Results per page (max 100) |
Implementation Reference
- src/harvest-client.ts:151-154 (handler)The main handler function that executes the tool logic: builds query parameters from input (is_active, page, per_page) and fetches clients list from Harvest API /clients endpoint.async getClients(options?: any) { const queryString = this.buildQueryString(options); return this.makeRequest(`/clients${queryString}`); }
- src/tools.ts:166-177 (schema)Defines the tool's name, description, and input schema for validation (filters: is_active, page, per_page).{ name: 'harvest_list_clients', description: 'List all clients with filtering options. Use about {"tool": "harvest_list_clients"} for detailed parameters and examples.', inputSchema: { type: 'object', properties: { is_active: { type: 'boolean', description: 'Filter by active status' }, page: { type: 'number', description: 'Page number' }, per_page: { type: 'number', description: 'Results per page (max 100)' } } } },
- src/index.ts:69-73 (registration)Registers all tools (including harvest_list_clients) for the MCP listTools request, providing schemas to clients.server.setRequestHandler(ListToolsRequestSchema, async () => { return { tools: tools, }; });
- src/index.ts:234-243 (handler)MCP server dispatch handler case that receives tool call, passes arguments to client.getClients(), and formats JSON response.case 'harvest_list_clients': const clients = await harvestClient.getClients(typedArgs); return { content: [ { type: 'text', text: JSON.stringify(clients, null, 2), }, ], };
- src/harvest-client.ts:59-71 (helper)Helper function used by getClients to construct URL query string from input parameters.private buildQueryString(params?: Record<string, any>): string { if (!params) return ''; const queryParams = new URLSearchParams(); Object.entries(params).forEach(([key, value]) => { if (value !== undefined && value !== null) { queryParams.append(key, String(value)); } }); const queryString = queryParams.toString(); return queryString ? `?${queryString}` : ''; }