Skip to main content
Glama
asachs01

Autotask MCP Server

create_expense_report

Create and submit expense reports in Autotask PSA by specifying submitter details, report name, description, and week ending date.

Instructions

Create a new expense report

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameNoExpense report name
descriptionNoExpense report description
submitterIdYesThe resource ID of the submitter
weekEndingDateNoWeek ending date (YYYY-MM-DD format)

Implementation Reference

  • Tool registration in listTools() method, defining the name, description, and input schema for create_expense_report
    {
      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']
      }
    },
  • Handler dispatch in callTool() switch statement that maps arguments 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;
  • Core implementation of createExpenseReport that initializes the Autotask client and calls the autotask-node library's expenses.create method to perform the API operation.
    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;
      }
    }

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