createProject
Set up new projects in Teamwork by defining project name, description, company ID, category ID, start date, end date, and status using Teamwork MCP's streamlined interface.
Instructions
Create a new project in Teamwork
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| categoryId | No | The ID of the category the project belongs to | |
| companyId | No | The ID of the company the project belongs to | |
| description | No | The description of the project | |
| endDate | No | The end date of the project (format: YYYYMMDD) | |
| name | Yes | The name of the project (required) | |
| startDate | No | The start date of the project (format: YYYYMMDD) | |
| status | No | The status of the project |
Implementation Reference
- src/tools/index.ts:66-68 (registration)Registration of the createProject tool (along with related project tools) in the toolPairs array, pairing the tool definition with its handler function.{ definition: getProjects, handler: handleGetProjects }, { definition: getCurrentProject, handler: handleGetCurrentProject }, { definition: createProject, handler: handleCreateProject },
- TypeScript interface defining the input parameters for creating a project.export interface CreateProjectData { name: string; description?: string; companyId?: number; categoryId?: number; startDate?: string; // Format: YYYYMMDD endDate?: string; // Format: YYYYMMDD status?: string; [key: string]: any; // Allow additional properties }
- The main function implementing the project creation logic, which calls the Teamwork API. This is likely invoked by the tool handler `handleCreateProject`.export const createProject = async (projectData: CreateProjectData) => { try { logger.info('Creating new project in Teamwork'); if (!projectData.name) { throw new Error('Project name is required'); } // The v1 API endpoint for creating projects is /projects.json const api = getApiClientForVersion('v1'); // The API expects the project data to be wrapped in a 'project' object const requestData = { project: projectData }; logger.info(`Creating project with name: ${projectData.name}`); const response = await api.post('/projects.json', requestData); logger.info(`Successfully created project: ${projectData.name}`); logger.info(`Project ID: ${response.data?.id || 'Unknown'}`); return response.data; } catch (error: any) { logger.error(`Failed to create project: ${error.message}`); throw new Error(`Failed to create project: ${error.message}`); } };
- src/tools/index.ts:108-111 (registration)Creation of the tool handlers map, which maps the tool name 'createProject' to its handler function.export const toolHandlersMap: Record<string, Function> = toolPairs.reduce((map, pair) => { map[pair.definition.name] = pair.handler; return map; }, {} as Record<string, Function>);
- src/utils/config.ts:250-250 (helper)Tool grouping configuration that includes 'createProject' for filtering purposes.'Projects': ['getProjects', 'getCurrentProject', 'createProject'],