Skip to main content
Glama

link_source_record

Link an AnchorID to a source record with a confidence score, creating or reactivating the link. Idempotent operation returns existing link on duplicate calls.

Instructions

Create or reactivate a link between an AnchorID and a source record. Idempotent — calling twice returns the existing link.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
entity_idYesUUID of the AnchorID to link to
source_record_idYesUUID of the source record to link
confidenceNoConfidence score for this link (0-1)
linked_byNoWho/what created this link (default: "api")

Implementation Reference

  • Handler function for the link_source_record tool. Destructures entity_id from the params and POSTs the remaining body (source_record_id, confidence, linked_by) to /entities/{entity_id}/links.
    async ({ entity_id, ...body }) => {
      try {
        const data = await api.post(
          `/entities/${entity_id}/links`,
          body as Record<string, unknown>,
        );
        return jsonContent(data);
      } catch (e) {
        return errorContent(e);
      }
    },
  • Input schema for link_source_record: entity_id (string), source_record_id (string), confidence (optional number 0-1), linked_by (optional string).
    {
      entity_id: z.string().describe("UUID of the AnchorID to link to"),
      source_record_id: z.string().describe("UUID of the source record to link"),
      confidence: z
        .number()
        .min(0)
        .max(1)
        .optional()
        .describe("Confidence score for this link (0-1)"),
      linked_by: z
        .string()
        .optional()
        .describe('Who/what created this link (default: "api")'),
    },
  • src/tools.ts:239-269 (registration)
    Registration of the 'link_source_record' tool via server.tool(), including description and schema.
    // ─── 6. link_source_record ───────────────────────────────────────
    server.tool(
      "link_source_record",
      "Create or reactivate a link between an AnchorID and a source record. " +
        "Idempotent — calling twice returns the existing link.",
      {
        entity_id: z.string().describe("UUID of the AnchorID to link to"),
        source_record_id: z.string().describe("UUID of the source record to link"),
        confidence: z
          .number()
          .min(0)
          .max(1)
          .optional()
          .describe("Confidence score for this link (0-1)"),
        linked_by: z
          .string()
          .optional()
          .describe('Who/what created this link (default: "api")'),
      },
      async ({ entity_id, ...body }) => {
        try {
          const data = await api.post(
            `/entities/${entity_id}/links`,
            body as Record<string, unknown>,
          );
          return jsonContent(data);
        } catch (e) {
          return errorContent(e);
        }
      },
    );
  • Helper function jsonContent() used to format API response data as MCP tool content.
    function jsonContent(data: unknown) {
      return {
        content: [{ type: "text" as const, text: JSON.stringify(data, null, 2) }],
      };
    }
  • Helper function errorContent() used to format errors (including ApiError) as MCP tool content with 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,
      };
    }
Behavior2/5

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

No annotations are provided, so the description carries full burden. It discloses idempotency but fails to mention side effects, authorization requirements, error conditions, or what happens on conflict. For a mutation tool, this is insufficient.

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

Conciseness4/5

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

The description is a single sentence, concise and front-loaded. It conveys the essential action immediately. No wasted words, though it lacks structural elements like bullet points or sections.

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

Completeness2/5

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

Given 4 parameters, no output schema, and no annotations, the description is minimal. It does not cover return values, error handling, or use case scenarios. More context is needed for a tool that creates links.

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 coverage is 100%—all parameters have descriptions in the input schema. The description adds idempotency context but does not enhance parameter meaning beyond what the schema already provides. Baseline 3 is appropriate.

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's purpose: creating or reactivating a link between an AnchorID and a source record. It uses specific verbs ('Create or reactivate') and resources ('AnchorID', 'source record'), and distinctly differentiates from the sibling tool 'unlink_source_record'.

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?

The description mentions idempotency, which provides usage guidance (safe to call multiple times), but lacks explicit when-to-use vs alternatives, prerequisites, or when not to use this tool. No comparison with sibling tools like 'ingest_record' or 'resolve_*'.

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