project_create
Create a new project as the top-level container for all work. Define its name, description, status, and tags to organize tasks and epics.
Instructions
Create a new project. Projects are the top-level container for all work.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | Project name | |
| description | No | Project description | |
| status | No | Project status | active |
| tags | No | Tags for categorization |
Implementation Reference
- src/tools/projects.ts:67-84 (handler)The actual handler function for the 'project_create' tool. It inserts a new project into the SQLite database (using the name, description, status, and tags from args) and logs the creation activity.
function handleProjectCreate(args: Record<string, unknown>) { const db = getDb(); const name = args.name as string; const description = (args.description as string) ?? null; const status = (args.status as string) ?? 'active'; const tags = JSON.stringify((args.tags as string[]) ?? []); const project = db .prepare( 'INSERT INTO projects (name, description, status, tags) VALUES (?, ?, ?, ?) RETURNING *' ) .get(name, description, status, tags); const row = project as Record<string, unknown>; logActivity(db, 'project', row.id as number, 'created', null, null, null, `Project '${name}' created`); return project; } - src/tools/projects.ts:8-31 (schema)The input schema definition for 'project_create' tool. Declares the tool name, description, and expected input parameters: name (required string), description, status (enum with default 'active'), and tags (array of strings).
{ name: 'project_create', description: 'Create a new project. Projects are the top-level container for all work.', annotations: { title: 'Create Project', readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false }, inputSchema: { type: 'object', properties: { name: { type: 'string', description: 'Project name' }, description: { type: 'string', description: 'Project description' }, status: { type: 'string', enum: ['active', 'on_hold', 'completed', 'archived'], default: 'active', description: 'Project status', }, tags: { type: 'array', items: { type: 'string' }, description: 'Tags for categorization', }, }, required: ['name'], }, }, - src/index.ts:10-49 (registration)Registration point: imports 'definitions' and 'handlers' from projects.ts. The definition is spread into ALL_TOOLS (line 24), and the handler is spread into ALL_HANDLERS (line 38). The handler lookup occurs in the CallToolRequestSchema handler at line 81.
import { definitions as projectDefs, handlers as projectHandlers } from './tools/projects.js'; import { definitions as epicDefs, handlers as epicHandlers } from './tools/epics.js'; import { definitions as taskDefs, handlers as taskHandlers } from './tools/tasks.js'; import { definitions as subtaskDefs, handlers as subtaskHandlers } from './tools/subtasks.js'; import { definitions as noteDefs, handlers as noteHandlers } from './tools/notes.js'; import { definitions as dashboardDefs, handlers as dashboardHandlers } from './tools/dashboard.js'; import { definitions as searchDefs, handlers as searchHandlers } from './tools/search.js'; import { definitions as activityDefs, handlers as activityHandlers } from './tools/activity.js'; import { definitions as commentDefs, handlers as commentHandlers } from './tools/comments.js'; import { definitions as templateDefs, handlers as templateHandlers } from './tools/templates.js'; import { definitions as exportImportDefs, handlers as exportImportHandlers } from './tools/export-import.js'; import { closeDb } from './db.js'; const ALL_TOOLS: Tool[] = [ ...projectDefs, ...epicDefs, ...taskDefs, ...subtaskDefs, ...noteDefs, ...commentDefs, ...templateDefs, ...dashboardDefs, ...searchDefs, ...activityDefs, ...exportImportDefs, ]; const ALL_HANDLERS: Record<string, (args: Record<string, unknown>) => unknown> = { ...projectHandlers, ...epicHandlers, ...taskHandlers, ...subtaskHandlers, ...noteHandlers, ...commentHandlers, ...templateHandlers, ...dashboardHandlers, ...searchHandlers, ...activityHandlers, ...exportImportHandlers, }; - src/tools/projects.ts:130-134 (registration)Exports the handlers mapping, which maps 'project_create' to the handleProjectCreate function.
export const handlers: Record<string, ToolHandler> = { project_create: handleProjectCreate, project_list: handleProjectList, project_update: handleProjectUpdate, }; - src/helpers/activity-logger.ts:3-17 (helper)The logActivity helper used by the handler to record the 'created' action in the activity_log table.
export function logActivity( db: Database.Database, entityType: string, entityId: number, action: string, fieldName: string | null, oldValue: string | null, newValue: string | null, summary: string ): void { db.prepare( `INSERT INTO activity_log (entity_type, entity_id, action, field_name, old_value, new_value, summary) VALUES (?, ?, ?, ?, ?, ?, ?)` ).run(entityType, entityId, action, fieldName, oldValue, newValue, summary); }