Skip to main content
Glama

list_entities

List all code entities (classes/functions) that implement a given concept, such as loss functions or network architectures. Returns entity names with semantic tags, enabling concept-based code search beyond simple text matching.

Instructions

Find all classes and functions matching a concept — e.g. all loss functions, all network architectures, all transform utilities. Returns entity names with their domain concept tags. Use describe_symbol to drill into any result. Impossible with grep alone because it understands which functions implement a concept, not just mention it. Use when asked 'what loss functions exist', 'show me the network classes', 'what uses concept X', or 'list all X'.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
conceptNoFilter by concept (e.g. 'loss')
roleNoFilter by semantic role substring (e.g. 'module')
kindNoFilter by entity kind
top_kNoMax entities to return (default: 20)

Implementation Reference

  • Schema/type definition for the list_entities tool - defines its mcpName, label, description, promptSnippet, and parameters (concept, role, kind, top_k).
    {
      mcpName: "list_entities",
      label: "List Entities",
      description:
        "Find classes and functions matching a semantic role or concept. " +
        "Returns entities with semantic roles and concept tags.",
      promptSnippet:
        "ontomics_list_entities: find functions/classes by concept or role",
      parameters: Type.Object({
        concept: Type.Optional(
          Type.String({ description: "Filter by concept (e.g. 'loss')" }),
        ),
        role: Type.Optional(
          Type.String({
            description: "Filter by semantic role substring (e.g. 'module')",
          }),
        ),
        kind: Type.Optional(
          StringEnum(["class", "function"] as const, {
            description: "Filter by entity kind",
          }),
        ),
        top_k: Type.Optional(
          Type.Integer({ description: "Max entities to return (default: 20)" }),
        ),
      }),
    },
  • Registration of the list_entities tool (along with all other tools) via pi.registerTool(), where the mcpName is prefixed with 'ontomics_' for the registered name.
    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)}`,
            );
          }
        },
      });
    }
  • The execute handler for list_entities (and other tools). It calls the MCP client's callTool method with the mcpName and cleaned parameters, delegating the actual implementation to the external 'ontomics' binary via JSON-RPC 2.0 over stdio.
    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)}`,
        );
      }
    },
  • The cleanArgs helper function used by the execute handler to strip undefined keys from parameters before forwarding to the MCP server.
    function cleanArgs(
      params: Record<string, unknown>,
    ): Record<string, unknown> {
      const out: Record<string, unknown> = {};
      for (const [k, v] of Object.entries(params)) {
        if (v !== undefined) out[k] = v;
      }
      return out;
    }
Behavior4/5

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

No annotations provided, so the description carries the burden. It implies a read-only query operation through examples and purpose, but does not explicitly state non-destructiveness or other behavioral traits. Still, the intent is clear and no contradictions exist.

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?

The description is concise with two main sentences plus usage examples. It is front-loaded with the core purpose, and every sentence contributes value. No unnecessary words.

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

Completeness4/5

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

Given no output schema, the description mentions return of 'entity names with their domain concept tags', which is adequate but could specify format or pagination. It is fairly complete for a list tool, with enough context to guide the agent.

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

Parameters3/5

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

Schema description coverage is 100%, so baseline is 3. The description adds example values for 'concept' but does not elaborate on 'role' or 'top_k' beyond what the schema already provides. It adds mild context but no substantial new meaning.

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 finds classes and functions matching a concept, with examples like 'loss functions' and 'network architectures'. It directly addresses the intent of listing entities by concept and distinguishes from the sibling 'describe_symbol' by mentioning drilling down.

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

Usage Guidelines5/5

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

The description provides explicit usage scenarios with example queries ('what loss functions exist', 'list all X') and contrasts with grep, explaining when this tool is superior. It also directs users to 'describe_symbol' for further details, setting clear boundaries.

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