create_contact
Add new contacts to Autotask by providing company ID, name, and contact details to maintain accurate client records.
Instructions
Create a new contact in Autotask
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| companyID | Yes | Company ID for the contact | |
| firstName | Yes | Contact first name | |
| lastName | Yes | Contact last name | |
| emailAddress | No | Contact email address | |
| phone | No | Contact phone number | |
| title | No | Contact job title |
Implementation Reference
- src/services/autotask.service.ts:303-316 (handler)Core implementation of the create_contact tool. Calls the autotask-node client to create a new contact via the Autotask API and returns the new contact ID.async createContact(contact: Partial<AutotaskContact>): Promise<number> { const client = await this.ensureClient(); try { this.logger.debug('Creating contact:', contact); const result = await client.contacts.create(contact as any); const contactId = (result.data as any)?.id; this.logger.info(`Contact created with ID: ${contactId}`); return contactId; } catch (error) { this.logger.error('Failed to create contact:', error); throw error; } }
- src/handlers/tool.handler.ts:195-228 (schema)Input schema definition and tool metadata (name, description) for the create_contact tool, returned by listTools().{ name: 'create_contact', description: 'Create a new contact in Autotask', inputSchema: { type: 'object', properties: { companyID: { type: 'number', description: 'Company ID for the contact' }, firstName: { type: 'string', description: 'Contact first name' }, lastName: { type: 'string', description: 'Contact last name' }, emailAddress: { type: 'string', description: 'Contact email address' }, phone: { type: 'string', description: 'Contact phone number' }, title: { type: 'string', description: 'Contact job title' } }, required: ['companyID', 'firstName', 'lastName'] } },
- src/handlers/tool.handler.ts:1096-1099 (handler)Dispatch handler in callTool method that routes create_contact calls to the AutotaskService.createContact method.case 'create_contact': result = await this.autotaskService.createContact(args); message = `Successfully created contact with ID: ${result}`; break;
- src/mcp/server.ts:98-103 (registration)MCP server registration of the listTools endpoint, which exposes the create_contact tool to MCP clients.this.server.setRequestHandler(ListToolsRequestSchema, async () => { try { this.logger.debug('Handling list tools request'); const tools = await this.toolHandler.listTools(); return { tools }; } catch (error) {