suggest_name
Generate project-consistent identifier names from a natural language description. Uses actual conventions like prefixes and patterns to suggest names that fit the existing codebase style. Use when naming functions, variables, or parameters.
Instructions
Generate project-consistent identifier names from a natural language description. Uses the project's actual conventions (prefixes like nb_, patterns like is_/has_, conversion patterns like x_to_y) to suggest names that fit the existing codebase style. Use when naming new functions, variables, or parameters.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| description | Yes | Natural language description (e.g. 'count of features') |
Implementation Reference
- pi/extensions/index.ts:178-191 (schema)Definition of the suggest_name tool including its MCP name, label, description, prompt snippet, and parameters schema (requires 'description' string).
{ mcpName: "suggest_name", label: "Suggest Name", description: "Generate project-consistent identifier names from a natural language " + "description using the project's actual conventions.", promptSnippet: "ontomics_suggest_name: generate convention-consistent names from description", parameters: Type.Object({ description: Type.String({ description: "Natural language description (e.g. 'count of features')", }), }), }, - pi/extensions/index.ts:362-387 (registration)Registration of all ontomics tools (including suggest_name) via pi.registerTool(), wrapping each tool definition with an execute handler that delegates to the MCP client.
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)The execute function for suggest_name (and all other ontomics tools). It calls the MCP client's callTool with the mcpName 'suggest_name', which delegates to an external ontomics serve process via JSON-RPC.
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)The McpClient.callTool helper method that sends a JSON-RPC tools/call with the tool name (e.g., 'suggest_name') and arguments to the external ontomics process over stdio.
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; }