create_company_note
Add notes to company records in Autotask PSA to document interactions, track issues, or record important information for future reference.
Instructions
Create a new note for a company
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| companyId | Yes | The company ID to add the note to | |
| title | No | Note title | |
| description | Yes | Note content | |
| actionType | No | Action type for the note |
Implementation Reference
- src/handlers/tool.handler.ts:658-683 (schema)Defines the tool schema including input parameters (companyId required, title, description, actionType) and description for the create_company_note MCP tool.{ name: 'create_company_note', description: 'Create a new note for a company', inputSchema: { type: 'object', properties: { companyId: { type: 'number', description: 'The company ID to add the note to' }, title: { type: 'string', description: 'Note title' }, description: { type: 'string', description: 'Note content' }, actionType: { type: 'number', description: 'Action type for the note' } }, required: ['companyId', 'description'] } },
- src/handlers/tool.handler.ts:1225-1232 (handler)Handler logic in callTool() method that validates args and delegates to autotaskService.createCompanyNote, formats success message.case 'create_company_note': result = await this.autotaskService.createCompanyNote(args.companyId, { title: args.title, description: args.description, actionType: args.actionType }); message = `Successfully created company note with ID: ${result}`; break;
- Core implementation: creates note using autotask-node client.notes.create API, maps companyId to accountId, handles logging and error propagation.async createCompanyNote(companyId: number, note: Partial<AutotaskCompanyNote>): Promise<number> { const client = await this.ensureClient(); try { this.logger.debug(`Creating company note for company ${companyId}:`, note); const noteData = { ...note, accountId: companyId }; const result = await client.notes.create(noteData as any); const noteId = (result.data as any)?.id; this.logger.info(`Company note created with ID: ${noteId}`); return noteId; } catch (error) { this.logger.error(`Failed to create company note for company ${companyId}:`, error); throw error; } }