Skip to main content
Glama

get_entity

Retrieve canonical AnchorIDs by UUID to resolve companies or people. Optionally fetch linked source records and relationships for complete entity context across systems.

Instructions

Fetch an AnchorID (canonical entity) by UUID. Optionally include linked source records via the include parameter (links, source_records, or both).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
entity_idYesUUID of the AnchorID to retrieve
includeNoComma-separated relations to include: "links", "source_records", or both

Implementation Reference

  • Handler function for get_entity tool - executes the API call to fetch an entity by UUID with optional includes
    async ({ entity_id, include }) => {
      try {
        const params: Record<string, string | undefined> = { include };
        const data = await api.get(`/entities/${entity_id}`, params);
        return jsonContent(data);
      } catch (e) {
        return errorContent(e);
      }
    },
  • src/tools.ts:214-237 (registration)
    Registration of the get_entity tool with name, description, schema, and handler
    // ─── 5. get_entity ───────────────────────────────────────────────
    server.tool(
      "get_entity",
      "Fetch an AnchorID (canonical entity) by UUID. Optionally include linked " +
        "source records via the include parameter (links, source_records, or both).",
      {
        entity_id: z.string().describe("UUID of the AnchorID to retrieve"),
        include: z
          .string()
          .optional()
          .describe(
            'Comma-separated relations to include: "links", "source_records", or both',
          ),
      },
      async ({ entity_id, include }) => {
        try {
          const params: Record<string, string | undefined> = { include };
          const data = await api.get(`/entities/${entity_id}`, params);
          return jsonContent(data);
        } catch (e) {
          return errorContent(e);
        }
      },
    );
  • Zod schema definition for get_entity tool parameters (entity_id and include)
    {
      entity_id: z.string().describe("UUID of the AnchorID to retrieve"),
      include: z
        .string()
        .optional()
        .describe(
          'Comma-separated relations to include: "links", "source_records", or both',
        ),
    },
  • Helper functions jsonContent and errorContent for formatting tool responses
    function jsonContent(data: unknown) {
      return {
        content: [{ type: "text" as const, text: JSON.stringify(data, null, 2) }],
      };
    }
    
    /** Format an error as MCP tool content (isError flag). */
    function errorContent(err: unknown) {
      if (err instanceof ApiError) {
        const payload = {
          error: err.message,
          status_code: err.status_code,
          request_id: err.request_id,
          details: err.details,
        };
        return {
          content: [{ type: "text" as const, text: JSON.stringify(payload, null, 2) }],
          isError: true,
        };
      }
      return {
        content: [{ type: "text" as const, text: (err as Error).message ?? String(err) }],
        isError: true,
      };
    }
  • ApiClient.get method used by get_entity handler to make HTTP GET requests
    async get<T = unknown>(
      path: string,
      params?: Record<string, string | undefined>,
    ): Promise<T> {
      const requestId = this.generateRequestId();
      const url = new URL(`${this.baseUrl}/api/v1${path}`);
      if (params) {
        for (const [k, v] of Object.entries(params)) {
          if (v !== undefined && v !== "") {
            url.searchParams.set(k, v);
          }
        }
      }
      const res = await fetch(url.toString(), {
        method: "GET",
        headers: this.headers(requestId),
      });
      return this.parse<T>(res, requestId);
Behavior3/5

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

No annotations provided, so description carries full burden. It discloses the optional inclusion behavior for linked records, but omits safety characteristics (read-only nature), error handling (e.g., 404 for invalid UUIDs), and return structure details.

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?

Two tightly constructed sentences with zero waste. Main action front-loaded in first sentence; optional behavior deferred to second. Every word earns its place.

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

Completeness3/5

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

Adequate for basic invocation given good schema coverage, but gaps remain: no output schema exists yet the description doesn't characterize the return structure (e.g., single entity vs. wrapped response) or error cases for missing UUIDs.

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?

Schema coverage is 100%, establishing baseline 3. Description adds value by enumerating specific valid values for include ('links', 'source_records', or both) and clarifying that entity_id refers to an AnchorID UUID, exceeding what the schema alone provides.

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

Purpose4/5

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

Clear verb ('Fetch') and resource ('AnchorID/canonical entity') with specific identifier ('by UUID'). The UUID specificity distinguishes it from sibling resolve_company/resolve_person tools which likely resolve by attributes rather than direct UUID lookup.

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

Usage Guidelines3/5

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

Provides implied usage through 'by UUID' phrasing, suggesting use when the canonical AnchorID is already known. However, lacks explicit guidance on when to use get_entity versus get_entity_export or the resolve_* alternatives.

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/nolenation04/anchord-mcp'

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