get_invoice
Retrieve a specific invoice by ID with complete details including line items, payments, and billing information from Harvest time tracking.
Instructions
Retrieve a specific invoice by ID with complete details including line items, payments, and billing information.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| invoice_id | Yes | The ID of the invoice to retrieve |
Implementation Reference
- src/tools/invoices.ts:38-56 (handler)Handler class that implements the logic to retrieve an invoice by ID.
class GetInvoiceHandler implements ToolHandler { constructor(private readonly config: BaseToolConfig) {} async execute(args: Record<string, any>): Promise<CallToolResult> { try { const inputSchema = z.object({ invoice_id: z.number().int().positive() }); const { invoice_id } = validateInput(inputSchema, args, 'get invoice'); logger.info('Fetching invoice from Harvest API', { invoiceId: invoice_id }); const invoice = await this.config.harvestClient.getInvoice(invoice_id); return { content: [{ type: 'text', text: JSON.stringify(invoice, null, 2) }], }; } catch (error) { return handleMCPToolError(error, 'get_invoice'); } } } - src/tools/invoices.ts:141-148 (schema)Input schema definition for the get_invoice tool.
inputSchema: { type: 'object', properties: { invoice_id: { type: 'number', description: 'The ID of the invoice to retrieve' }, }, required: ['invoice_id'], additionalProperties: false, }, - src/tools/invoices.ts:137-151 (registration)Registration of the get_invoice tool within the invoice tools list.
{ tool: { name: 'get_invoice', description: 'Retrieve a specific invoice by ID with complete details including line items, payments, and billing information.', inputSchema: { type: 'object', properties: { invoice_id: { type: 'number', description: 'The ID of the invoice to retrieve' }, }, required: ['invoice_id'], additionalProperties: false, }, }, handler: new GetInvoiceHandler(config), },