locate_concept
Find ranked entry points—key functions, classes, and files—to understand a concept, reducing manual search. Includes contrastive concepts to clarify boundaries. Use for 'how does X work' or 'where is X defined'.
Instructions
Find the best entry points for understanding a concept — returns a ranked shortlist of key functions, classes, and files to read, plus contrastive concepts that clarify boundaries. Saves reading dozens of grep matches by surfacing the most important locations first. Use when asked 'how does X work', 'where should I look for X', or 'where are X defined'.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| term | Yes | Concept to locate (e.g. 'transform') |
Implementation Reference
- pi/extensions/index.ts:246-258 (schema)Tool definition for 'locate_concept' including its MCP name, label, description, promptSnippet, and parameter schema (term: string). This is the TypeScript type/schema definition.
{ mcpName: "locate_concept", label: "Locate Concept", description: "Find the best entry points for understanding a concept — ranked " + "shortlist of key functions, classes, and files to read.", promptSnippet: "ontomics_locate_concept: find key entry points for a concept", parameters: Type.Object({ term: Type.String({ description: "Concept to locate (e.g. 'transform')", }), }), - pi/extensions/index.ts:362-387 (registration)Registration of all tools including 'locate_concept'. The tool is registered via pi.registerTool with the name 'ontomics_locate_concept'. The execute handler delegates to an external ontomics MCP binary via the McpClient class.
for (const def of toolDefs()) { pi.registerTool({ name: `ontomics_${def.mcpName}`, label: def.label, description: def.description, promptSnippet: def.promptSnippet, promptGuidelines: [ "Use ontomics tools BEFORE grep/glob for semantic codebase questions.", ], parameters: def.parameters, async execute(_toolCallId, params, _signal, onUpdate, _ctx) { onUpdate?.({ content: [{ type: "text", text: `Querying ontomics: ${def.mcpName}...` }], }); try { const mcp = await getClient(); const text = await mcp.callTool(def.mcpName, cleanArgs(params)); return { content: [{ type: "text", text }] }; } catch (err) { throw new Error( `ontomics ${def.mcpName} failed: ${err instanceof Error ? err.message : String(err)}`, ); } }, }); } - pi/extensions/index.ts:372-385 (handler)Generic execute handler for all tools (including locate_concept). Sends a JSON-RPC 'tools/call' request to the external ontomics binary over stdio, passing the tool name 'locate_concept' and cleaned parameters.
async execute(_toolCallId, params, _signal, onUpdate, _ctx) { onUpdate?.({ content: [{ type: "text", text: `Querying ontomics: ${def.mcpName}...` }], }); try { const mcp = await getClient(); const text = await mcp.callTool(def.mcpName, cleanArgs(params)); return { content: [{ type: "text", text }] }; } catch (err) { throw new Error( `ontomics ${def.mcpName} failed: ${err instanceof Error ? err.message : String(err)}`, ); } }, - pi/extensions/index.ts:44-54 (helper)McpClient.callTool method that performs the actual JSON-RPC call to the ontomics binary. This is what the execute handler uses to invoke 'locate_concept' on the Rust backend.
async callTool( name: string, args: Record<string, unknown>, ): Promise<string> { const result = (await this.request("tools/call", { name, arguments: args, })) as { content?: Array<{ text?: string }> }; const text = result.content?.[0]?.text ?? JSON.stringify(result); return text; }