tracker_init
Initialize project tracking in Saga MCP by setting up or accessing a structured database for tasks, epics, and decisions across sessions.
Instructions
Initialize the tracker for a project. If the database is empty, creates a project with the given name. If a project already exists, returns its info.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| project_name | No | Name for a new project (only used if DB is empty) | |
| project_description | No | Description for the new project |
Implementation Reference
- src/tools/dashboard.ts:189-220 (handler)The handleTrackerInit function handles the initialization logic for the tracker, including creating a new project if the database is empty.
function handleTrackerInit(args: Record<string, unknown>) { const db = getDb(); const existing = db.prepare('SELECT * FROM projects LIMIT 1').get(); if (existing) { return { message: 'Tracker already initialized. Returning existing project.', project: existing, }; } const projectName = args.project_name as string | undefined; if (!projectName) { return { message: 'Database is empty. Provide a project_name to create your first project.', projects: [], }; } const description = (args.project_description as string) ?? null; const project = db .prepare('INSERT INTO projects (name, description) VALUES (?, ?) RETURNING *') .get(projectName, description); const row = project as Record<string, unknown>; logActivity(db, 'project', row.id as number, 'created', null, null, null, `Project '${projectName}' initialized`); return { message: `Project '${projectName}' created. Use epic_create to start adding work.`, project, }; } - src/tools/dashboard.ts:19-31 (schema)Tool definition for 'tracker_init' including input schema.
{ name: 'tracker_init', description: 'Initialize the tracker for a project. If the database is empty, creates a project with the given name. If a project already exists, returns its info.', annotations: { title: 'Initialize Tracker', readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false }, inputSchema: { type: 'object', properties: { project_name: { type: 'string', description: 'Name for a new project (only used if DB is empty)' }, project_description: { type: 'string', description: 'Description for the new project' }, }, }, }, - src/tools/dashboard.ts:222-225 (registration)Registration of the 'tracker_init' tool in the handlers mapping.
export const handlers: Record<string, ToolHandler> = { tracker_dashboard: handleDashboard, tracker_init: handleTrackerInit, };