create_expense_report
Create new expense reports in Autotask by specifying submitter details, report name, description, and week ending date for accurate expense tracking and reimbursement processing.
Instructions
Create a new expense report
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| description | No | Expense report description | |
| name | No | Expense report name | |
| submitterId | Yes | The resource ID of the submitter | |
| weekEndingDate | No | Week ending date (YYYY-MM-DD format) |
Implementation Reference
- Primary handler implementation that creates an expense report using the Autotask API client (autotask-node). Handles client initialization, API call, logging, and error handling.async createExpenseReport(report: Partial<AutotaskExpenseReport>): Promise<number> { const client = await this.ensureClient(); try { this.logger.debug('Creating expense report:', report); const result = await client.expenses.create(report as any); const reportId = (result.data as any)?.id; this.logger.info(`Expense report created with ID: ${reportId}`); return reportId; } catch (error) { this.logger.error('Failed to create expense report:', error); throw error; } }
- src/handlers/tool.handler.ts:1260-1268 (handler)Dispatching handler in the main tool switch statement (callTool method). Maps tool arguments to service parameters and calls AutotaskService.createExpenseReport.case 'create_expense_report': result = await this.autotaskService.createExpenseReport({ name: args.name, description: args.description, submitterID: args.submitterId, weekEndingDate: args.weekEndingDate }); message = `Successfully created expense report with ID: ${result}`; break;
- src/handlers/tool.handler.ts:769-794 (registration)Tool registration entry in the listTools() method array. Defines the tool name, description, input schema (JSON Schema for validation), and required parameters.{ name: 'create_expense_report', description: 'Create a new expense report', inputSchema: { type: 'object', properties: { name: { type: 'string', description: 'Expense report name' }, description: { type: 'string', description: 'Expense report description' }, submitterId: { type: 'number', description: 'The resource ID of the submitter' }, weekEndingDate: { type: 'string', description: 'Week ending date (YYYY-MM-DD format)' } }, required: ['submitterId'] } },
- src/handlers/tool.handler.ts:772-793 (schema)JSON Schema definition for the create_expense_report tool input parameters, specifying types, descriptions, and required fields for MCP validation.inputSchema: { type: 'object', properties: { name: { type: 'string', description: 'Expense report name' }, description: { type: 'string', description: 'Expense report description' }, submitterId: { type: 'number', description: 'The resource ID of the submitter' }, weekEndingDate: { type: 'string', description: 'Week ending date (YYYY-MM-DD format)' } }, required: ['submitterId'] }