setProjectCommand
Configure custom shell commands for specific projects to adapt execution based on project type and environment.
Instructions
Add or update a project-specific command override
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| projectName | Yes | ||
| key | Yes | ||
| value | Yes |
Implementation Reference
- src/server.ts:176-181 (handler)Core handler function that loads the project-commands.json, sets or updates the specified key-value for the project, saves it back, and returns the update.async function setProjectCommand(projectName: string, key: string, value: string) { const data = await loadJson<Record<string, Record<string, string>>>(PROJECT_COMMANDS_PATH, { default: {} }); if (!data[projectName]) data[projectName] = {}; data[projectName][key] = value; await saveJson(PROJECT_COMMANDS_PATH, data); return { projectName, key, value };
- src/server.ts:401-401 (schema)Input schema definition using Zod for the tool parameters: projectName, key, value as strings.inputSchema: { projectName: z.string(), key: z.string(), value: z.string() }
- src/server.ts:396-407 (registration)MCP server registration of the 'setProjectCommand' tool, including name, metadata/schema, and thin wrapper handler that calls the core function and formats response.server.registerTool( "setProjectCommand", { title: "Set a project command", description: "Add or update a project-specific command override", inputSchema: { projectName: z.string(), key: z.string(), value: z.string() } }, async ({ projectName, key, value }) => { const res = await setProjectCommand(projectName, key, value); return { content: [{ type: "text", text: JSON.stringify(res, null, 2) }] }; } );