create_task
Create new tasks in Autotask by specifying project ID, title, status, assigned resources, estimated hours, and scheduling details to organize project work.
Instructions
Create a new task in Autotask
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| assignedResourceID | No | Assigned resource ID | |
| description | No | Task description | |
| endDateTime | No | Task end date/time (ISO format) | |
| estimatedHours | No | Estimated hours for the task | |
| projectID | Yes | Project ID for the task | |
| startDateTime | No | Task start date/time (ISO format) | |
| status | Yes | Task status (1=New, 2=In Progress, 5=Complete) | |
| title | Yes | Task title |
Implementation Reference
- Core handler function that executes the create_task tool logic by calling the autotask-node client's tasks.create() method.async createTask(task: Partial<AutotaskTask>): Promise<number> { const client = await this.ensureClient(); try { this.logger.debug('Creating task:', task); const result = await client.tasks.create(task as any); const taskId = (result.data as any)?.id; this.logger.info(`Task created with ID: ${taskId}`); return taskId; } catch (error) { this.logger.error('Failed to create task:', error); throw error; } }
- Input schema and metadata definition for the create_task tool returned by listTools(){ name: 'create_task', description: 'Create a new task in Autotask', inputSchema: { type: 'object', properties: { projectID: { type: 'number', description: 'Project ID for the task' }, title: { type: 'string', description: 'Task title' }, description: { type: 'string', description: 'Task description' }, status: { type: 'number', description: 'Task status (1=New, 2=In Progress, 5=Complete)' }, assignedResourceID: { type: 'number', description: 'Assigned resource ID' }, estimatedHours: { type: 'number', description: 'Estimated hours for the task' }, startDateTime: { type: 'string', description: 'Task start date/time (ISO format)' }, endDateTime: { type: 'string', description: 'Task end date/time (ISO format)' } }, required: ['projectID', 'title', 'status'] } }
- src/handlers/tool.handler.ts:1168-1171 (handler)MCP tool dispatch case in AutotaskToolHandler.callTool() that invokes the service layer.case 'create_task': result = await this.autotaskService.createTask(args); message = `Successfully created task with ID: ${result}`; break;
- src/mcp/server.ts:97-131 (registration)MCP server registration of listTools and callTool request handlers that delegate to the tool handler providing create_task.// List available tools this.server.setRequestHandler(ListToolsRequestSchema, async () => { try { this.logger.debug('Handling list tools request'); const tools = await this.toolHandler.listTools(); return { tools }; } catch (error) { this.logger.error('Failed to list tools:', error); throw new McpError( ErrorCode.InternalError, `Failed to list tools: ${error instanceof Error ? error.message : 'Unknown error'}` ); } }); // Call a tool this.server.setRequestHandler(CallToolRequestSchema, async (request) => { try { this.logger.debug(`Handling tool call: ${request.params.name}`); const result = await this.toolHandler.callTool( request.params.name, request.params.arguments || {} ); return { content: result.content, isError: result.isError }; } catch (error) { this.logger.error(`Failed to call tool ${request.params.name}:`, error); throw new McpError( ErrorCode.InternalError, `Failed to call tool: ${error instanceof Error ? error.message : 'Unknown error'}` ); } });
- src/mcp/server.ts:55-57 (registration)Instantiation of the EnhancedAutotaskToolHandler (extends base handler containing create_task) for use in MCP server.this.resourceHandler = new AutotaskResourceHandler(this.autotaskService, logger); this.toolHandler = new EnhancedAutotaskToolHandler(this.autotaskService, logger);