Skip to main content
Glama
initialize-project.js2.52 kB
import { createErrorResponse, handleApiResult, withNormalizedProjectRoot } from '@tm/mcp'; import { z } from 'zod'; import { RULE_PROFILES } from '../../../src/constants/profiles.js'; import { initializeProjectDirect } from '../core/task-master-core.js'; export function registerInitializeProjectTool(server) { server.addTool({ name: 'initialize_project', description: 'Initializes a new Task Master project structure by calling the core initialization logic. Creates necessary folders and configuration files for Task Master in the current directory.', parameters: z.object({ skipInstall: z .boolean() .optional() .default(false) .describe( 'Skip installing dependencies automatically. Never do this unless you are sure the project is already installed.' ), addAliases: z .boolean() .optional() .default(true) .describe( 'Add shell aliases (tm, taskmaster, hamster, ham) to shell config file.' ), initGit: z .boolean() .optional() .default(true) .describe('Initialize Git repository in project root.'), storeTasksInGit: z .boolean() .optional() .default(true) .describe('Store tasks in Git (tasks.json and tasks/ directory).'), yes: z .boolean() .optional() .default(true) .describe( 'Skip prompts and use default values. Always set to true for MCP tools.' ), projectRoot: z .string() .describe( 'The root directory for the project. ALWAYS SET THIS TO THE PROJECT ROOT DIRECTORY. IF NOT SET, THE TOOL WILL NOT WORK.' ), rules: z .array(z.enum(RULE_PROFILES)) .optional() .describe( `List of rule profiles to include at initialization. If omitted, defaults to Cursor profile only. Available options: ${RULE_PROFILES.join(', ')}` ) }), execute: withNormalizedProjectRoot(async (args, context) => { const { log } = context; const session = context.session; try { log.info( `Executing initialize_project tool with args: ${JSON.stringify(args)}` ); const result = await initializeProjectDirect(args, log, { session }); return handleApiResult({ result, log: log, errorPrefix: 'Initialization failed', projectRoot: args.projectRoot }); } catch (error) { const errorMessage = `Project initialization tool failed: ${error.message || 'Unknown error'}`; log.error(errorMessage, error); return createErrorResponse(errorMessage, { details: error.stack }); } }) }); }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/eyaltoledano/claude-task-master'

If you have feedback or need assistance with the MCP directory API, please join our Discord server