Skip to main content
Glama

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
NameRequiredDescriptionDefault
client_idNoFilter by client ID
project_idNoFilter by project ID
stateNoFilter by invoice state
fromNoStart date for date range filter (YYYY-MM-DD)
toNoEnd date for date range filter (YYYY-MM-DD)
updated_sinceNoFilter by invoices updated since this timestamp
pageNoPage number for pagination
per_pageNoNumber of invoices per page (max 2000)

Implementation Reference

  • 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');
        }
      }
    }
  • 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),
    },

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/ianaleck/harvest-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server