list_invoices
Retrieve and filter invoices from Harvest by client, project, state, or date range to manage billing and track payments with paginated results.
Instructions
Retrieve invoices with optional filtering by client, project, state, and date ranges. Returns paginated results with complete invoice details.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| client_id | No | Filter by client ID | |
| project_id | No | Filter by project ID | |
| state | No | Filter by invoice state | |
| from | No | Start date for date range filter (YYYY-MM-DD) | |
| to | No | End date for date range filter (YYYY-MM-DD) | |
| updated_since | No | Filter by invoices updated since this timestamp | |
| page | No | Page number for pagination | |
| per_page | No | Number of invoices per page (max 2000) |
Implementation Reference
- src/tools/invoices.ts:20-36 (handler)The ListInvoicesHandler class implements the execution logic for the list_invoices tool.
class ListInvoicesHandler implements ToolHandler { constructor(private readonly config: BaseToolConfig) {} async execute(args: Record<string, any>): Promise<CallToolResult> { try { const validatedArgs = validateInput(InvoiceQuerySchema, args, 'invoice query'); logger.info('Listing invoices from Harvest API'); const invoices = await this.config.harvestClient.getInvoices(validatedArgs); return { content: [{ type: 'text', text: JSON.stringify(invoices, null, 2) }], }; } catch (error) { return handleMCPToolError(error, 'list_invoices'); } } } - src/tools/invoices.ts:116-136 (registration)The list_invoices tool is registered within the registerInvoiceTools function in src/tools/invoices.ts.
{ tool: { name: 'list_invoices', description: 'Retrieve invoices with optional filtering by client, project, state, and date ranges. Returns paginated results with complete invoice details.', inputSchema: { type: 'object', properties: { client_id: { type: 'number', description: 'Filter by client ID' }, project_id: { type: 'number', description: 'Filter by project ID' }, state: { type: 'string', enum: ['draft', 'open', 'paid', 'closed'], description: 'Filter by invoice state' }, from: { type: 'string', format: 'date', description: 'Start date for date range filter (YYYY-MM-DD)' }, to: { type: 'string', format: 'date', description: 'End date for date range filter (YYYY-MM-DD)' }, updated_since: { type: 'string', format: 'date-time', description: 'Filter by invoices updated since this timestamp' }, page: { type: 'number', minimum: 1, description: 'Page number for pagination' }, per_page: { type: 'number', minimum: 1, maximum: 2000, description: 'Number of invoices per page (max 2000)' }, }, additionalProperties: false, }, }, handler: new ListInvoicesHandler(config), },