Skip to main content
Glama

vocabulary_health

Measure codebase vocabulary health: convention coverage, naming consistency, and semantic cluster cohesion. Identify top inconsistencies and uncovered identifiers to improve code quality.

Instructions

Measure the vocabulary health of this codebase — returns convention coverage (how many identifiers follow conventions), consistency ratio (how uniformly concepts are spelled), and cluster cohesion (how well semantic clusters hold together). Use when asked about code quality, naming consistency, or vocabulary health. Returns an overall score plus top inconsistencies and uncovered identifiers.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The tool 'vocabulary_health' is registered via pi.registerTool in a loop over toolDefs(). The registration wraps the mcpName 'vocabulary_health' into the prefixed name 'ontomics_vocabulary_health' and delegates execution to an external MCP subprocess (ontomics serve).
    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)}`,
            );
          }
        },
      });
    }
  • Tool definition schema for 'vocabulary_health' within toolDefs(): mcpName: 'vocabulary_health', label: 'Vocabulary Health', description about convention coverage/consistency/cluster cohesion, and an empty parameters object (Type.Object({})).
    {
      mcpName: "vocabulary_health",
      label: "Vocabulary Health",
      description:
        "Measure vocabulary health — convention coverage, consistency ratio, " +
        "cluster cohesion, top inconsistencies.",
      promptSnippet:
        "ontomics_vocabulary_health: code quality metrics for naming consistency",
      parameters: Type.Object({}),
    },
  • The execute handler for all ontomics tools (including vocabulary_health). It calls the external ontomics MCP server via McpClient.callTool with the tool's mcpName and cleaned parameters, returning the text result.
    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)}`,
        );
      }
    },
  • McpClient class that communicates with the external 'ontomics serve' process over stdio JSON-RPC. The callTool method (line 44) is used by the handler to invoke the actual tool on the server side.
    class McpClient {
      private proc: ChildProcess;
      private rl: ReadlineInterface;
      private nextId = 1;
      private pending = new Map<
        number,
        { resolve: (v: unknown) => void; reject: (e: Error) => void }
      >();
    
      private constructor(proc: ChildProcess) {
        this.proc = proc;
        this.rl = createInterface({ input: proc.stdout! });
        this.rl.on("line", (line: string) => this.onLine(line));
        proc.stderr?.on("data", () => {});
      }
    
      static async start(binaryPath: string, cwd: string): Promise<McpClient> {
        const proc = spawn(binaryPath, ["serve"], {
          cwd,
          stdio: ["pipe", "pipe", "pipe"],
        });
        const client = new McpClient(proc);
        await client.request("initialize", {
          protocolVersion: "2024-11-05",
          capabilities: {},
          clientInfo: { name: "pi-ontomics", version: "1.0.0" },
        });
        client.notify("notifications/initialized", {});
        return client;
      }
    
      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;
      }
    
      dispose(): void {
        this.proc.kill();
        this.rl.close();
      }
    
      get alive(): boolean {
        return !this.proc.killed && this.proc.exitCode === null;
      }
    
      private request(method: string, params: unknown): Promise<unknown> {
        const id = this.nextId++;
        return new Promise((resolve, reject) => {
          this.pending.set(id, { resolve, reject });
          this.write({ jsonrpc: "2.0", id, method, params });
        });
      }
    
      private notify(method: string, params: unknown): void {
        this.write({ jsonrpc: "2.0", method, params });
      }
    
      private write(msg: unknown): void {
        this.proc.stdin!.write(JSON.stringify(msg) + "\n");
      }
    
      private onLine(line: string): void {
        if (!line.trim()) return;
        try {
          const msg = JSON.parse(line) as {
            id?: number;
            result?: unknown;
            error?: { message: string };
          };
          if (msg.id != null && this.pending.has(msg.id)) {
            const { resolve, reject } = this.pending.get(msg.id)!;
            this.pending.delete(msg.id);
            if (msg.error) reject(new Error(msg.error.message));
            else resolve(msg.result);
          }
        } catch {
          // ignore non-JSON lines (e.g. stderr leaks)
        }
      }
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden. It discloses that the tool returns an overall score plus top inconsistencies and uncovered identifiers. It does not mention side effects (likely none). Could benefit from stating that it is a read-only operation.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Three sentences, each adding value: purpose, usage guidance, and output description. No redundant or extraneous information.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Despite having no output schema, the description clearly explains the return value (overall score plus top inconsistencies and uncovered identifiers). This is sufficient for an agent to understand the tool's output.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has no parameters, so schema description coverage is effectively 100%. The description adds value by explaining the metrics returned, which compensates for the lack of parameter documentation.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool measures vocabulary health with three specific metrics (convention coverage, consistency ratio, cluster cohesion). It uses a specific verb+resource and distinguishes from sibling tools like check_naming and suggest_name.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Provides explicit usage context: 'Use when asked about code quality, naming consistency, or vocabulary health.' No exclusions or alternatives are mentioned, but given the tool's specificity, it is sufficient.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/EtienneChollet/ontomics'

If you have feedback or need assistance with the MCP directory API, please join our Discord server