MCPcopy
hub / github.com/colbymchenry/codegraph / withRequiredProjectPath

Function withRequiredProjectPath

src/mcp/tools.ts:736–746  ·  view source on GitHub ↗

* Return `defs` with `projectPath` marked `required` in each tool's inputSchema. * * Used for the NO-DEFAULT-PROJECT tool surface (issue #993): when the MCP server * has no default project to fall back to — a gateway server started outside any * repo, or a monorepo root whose `.codegraph/` index

(defs: ToolDefinition[])

Source from the content-addressed store, hash-verified

734 * `required` list (status/files) gains `['projectPath']`.
735 */
736function withRequiredProjectPath(defs: ToolDefinition[]): ToolDefinition[] {
737 return defs.map((tool) => {
738 if (!tool.inputSchema.properties.projectPath) return tool;
739 const required = tool.inputSchema.required ?? [];
740 if (required.includes('projectPath')) return tool;
741 return {
742 ...tool,
743 inputSchema: { ...tool.inputSchema, required: [...required, 'projectPath'] },
744 };
745 });
746}
747
748/**
749 * Allowlist-filtered tool definitions WITHOUT an engine — the static surface the

Callers 1

getToolsMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected