Skip to main content
Glama

search_expense_reports

Find and filter expense reports in Autotask by submitter, status, or page size to manage financial documentation and track reimbursement processes.

Instructions

Search for expense reports with optional filters

Input Schema

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

Implementation Reference

  • Tool schema definition including name, description, and input schema validation 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: [] } },
  • Dispatch handler in callTool method that maps arguments and calls the AutotaskService.searchExpenseReports method
    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;
  • Core implementation of searchExpenseReports: builds filters for submitterId and status, calls autotask-node client.expenses.list API, and returns 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; } }

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