Skip to main content
Glama

search_expense_reports

Search for expense reports using filters like submitter, status, or page size to quickly find and review financial documentation in Autotask.

Instructions

Search for expense reports with optional filters

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pageSizeNoNumber of results to return (default: 25, max: 100)
statusNoFilter by status (1=New, 2=Submitted, 3=Approved, 4=Paid, 5=Rejected, 6=InReview)
submitterIdNoFilter by submitter resource ID

Implementation Reference

  • Tool registration including name, description, and input schema definition for 'search_expense_reports'
    { name: 'search_expense_reports', description: 'Search for expense reports with optional filters', inputSchema: { type: 'object', properties: { submitterId: { type: 'number', description: 'Filter by submitter resource ID' }, status: { type: 'number', description: 'Filter by status (1=New, 2=Submitted, 3=Approved, 4=Paid, 5=Rejected, 6=InReview)' }, pageSize: { type: 'number', description: 'Number of results to return (default: 25, max: 100)', minimum: 1, maximum: 100 } }, required: [] } },
  • Core handler implementation: builds filters for submitterId (mapped to resourceId) and status, calls Autotask API expenses.list, returns typed expense reports
    async searchExpenseReports(options: AutotaskQueryOptionsExtended = {}): Promise<AutotaskExpenseReport[]> { const client = await this.ensureClient(); try { this.logger.debug('Searching expense reports with options:', options); // Build filter based on provided options const filters = []; if (options.submitterId) { filters.push({ field: 'resourceId', op: 'eq', value: options.submitterId }); } if (options.status) { filters.push({ field: 'status', op: 'eq', value: options.status }); } const queryOptions = { filter: filters.length > 0 ? filters : [{ field: 'id', op: 'gte', value: 0 }], pageSize: options.pageSize || 25 }; const result = await client.expenses.list(queryOptions); const reports = (result.data as any[]) || []; this.logger.info(`Retrieved ${reports.length} expense reports`); return reports as AutotaskExpenseReport[]; } catch (error) { this.logger.error('Failed to search expense reports:', error); throw error; } }
  • MCP tool handler dispatch: maps tool args to service method and formats response (duplicate case exists at lines 1407-1414)
    case 'search_expense_reports': result = await this.autotaskService.searchExpenseReports({ submitterId: args.submitterId, status: args.status, pageSize: args.pageSize }); message = `Found ${result.length} expense reports`; break;

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/asachs01/autotask-mcp'

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