init_project
Set up the Git Conflict MCP environment by specifying the project root directory path to enable conflict detection and resolution workflows.
Instructions
Initialize the project by setting the root directory path. This must be the first tool called to set up the environment.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | Absolute path to the git project root. |
Implementation Reference
- src/tools/initProject.ts:15-26 (handler)The handler function for the init_project tool. It validates the provided path as a directory, sets the project path in the state, and returns a success or error message.async ({ path: p }) => { try { const stats = await fs.stat(p); if (!stats.isDirectory()) { return { content: [{ type: "text", text: "Path is not a directory." }], isError: true }; } state.setProjectPath(p); return { content: [{ type: "text", text: `initialized at ${p}` }] }; } catch (e) { return { content: [{ type: "text", text: `Invalid path: ${e}` }], isError: true }; } }
- src/tools/initProject.ts:11-13 (schema)Zod input schema defining the required 'path' parameter as a string with description.inputSchema: z.object({ path: z.string().describe("Absolute path to the git project root."), }),
- src/tools/initProject.ts:6-28 (registration)The registerInitProject function that registers the 'init_project' tool with the MCP server, including its name, description, schema, and handler.export function registerInitProject(server: McpServer) { server.registerTool( "init_project", { description: "Initialize the project by setting the root directory path. This must be the first tool called to set up the environment.", inputSchema: z.object({ path: z.string().describe("Absolute path to the git project root."), }), }, async ({ path: p }) => { try { const stats = await fs.stat(p); if (!stats.isDirectory()) { return { content: [{ type: "text", text: "Path is not a directory." }], isError: true }; } state.setProjectPath(p); return { content: [{ type: "text", text: `initialized at ${p}` }] }; } catch (e) { return { content: [{ type: "text", text: `Invalid path: ${e}` }], isError: true }; } } ); }
- src/tools/index.ts:12-12 (registration)Invocation of registerInitProject within the registerTools function to register the init_project tool.registerInitProject(server);