Skip to main content
Glama

guard_write

Evaluate whether to allow proposed writes by verifying AnchorID existence, confidence thresholds, unresolved conflicts, and canonical link presence.

Instructions

Evaluation-only pre-write safety check. Verifies the AnchorID exists, confidence meets threshold, no unresolved conflicts, and at least one canonical link is present. Returns allowed/blocked with reasons. This tool does NOT perform any write — the caller decides whether to proceed.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
entity_idYesUUID of the AnchorID to evaluate
min_confidenceNoMinimum confidence threshold (default: 0.70)
require_no_conflictsNoBlock if unresolved conflicts exist (default: true)

Implementation Reference

  • src/tools.ts:293-320 (registration)
    The guard_write tool is registered here with server.tool(). It includes the tool name, description, Zod schema for input validation, and the async handler function.
    server.tool(
      "guard_write",
      "Evaluation-only pre-write safety check. Verifies the AnchorID exists, " +
        "confidence meets threshold, no unresolved conflicts, and at least one " +
        "canonical link is present. Returns allowed/blocked with reasons. " +
        "This tool does NOT perform any write — the caller decides whether to proceed.",
      {
        entity_id: z.string().describe("UUID of the AnchorID to evaluate"),
        min_confidence: z
          .number()
          .min(0)
          .max(1)
          .optional()
          .describe("Minimum confidence threshold (default: 0.70)"),
        require_no_conflicts: z
          .boolean()
          .optional()
          .describe("Block if unresolved conflicts exist (default: true)"),
      },
      async (input) => {
        try {
          const data = await api.post("/guard/write", input as Record<string, unknown>);
          return jsonContent(data);
        } catch (e) {
          return errorContent(e);
        }
      },
    );
  • The handler function that executes the guard_write tool logic. It makes a POST request to /guard/write endpoint via the ApiClient and returns the response formatted as JSON content.
    async (input) => {
      try {
        const data = await api.post("/guard/write", input as Record<string, unknown>);
        return jsonContent(data);
      } catch (e) {
        return errorContent(e);
      }
    },
  • Zod schema definition for guard_write input validation. Defines entity_id (required string), min_confidence (optional number 0-1), and require_no_conflicts (optional boolean).
    {
      entity_id: z.string().describe("UUID of the AnchorID to evaluate"),
      min_confidence: z
        .number()
        .min(0)
        .max(1)
        .optional()
        .describe("Minimum confidence threshold (default: 0.70)"),
      require_no_conflicts: z
        .boolean()
        .optional()
        .describe("Block if unresolved conflicts exist (default: true)"),
    },
  • Helper functions jsonContent and errorContent used by guard_write (and other tools) to format API responses and errors as MCP tool content.
    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,
      };
    }
Behavior4/5

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

With no annotations provided, the description carries the full burden and succeeds in disclosing key behavioral traits: it clarifies the tool is read-only/evaluation-only ('does NOT perform any write'), explains the decision logic ('Returns allowed/blocked with reasons'), and notes the four specific validation checks performed.

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 consists of three highly efficient sentences front-loaded with the critical 'Evaluation-only' classification. Every sentence earns its place: the first defines the tool type, the second lists specific checks and return values, and the third provides the essential disclaimer about write operations.

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 the lack of output schema and annotations, the description appropriately compensates by describing the conceptual return values ('allowed/blocked with reasons') and behavioral constraints. It adequately covers the 3 simple parameters, though it could slightly improve by mentioning error conditions or explicitly naming the write counterpart.

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%, establishing a baseline of 3. The description mentions validation checks that loosely map to parameters (confidence threshold, conflicts) but does not add semantic details beyond what the schema already provides (e.g., it does not explain the 0-1 range for min_confidence or UUID format for entity_id).

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 explicitly states the tool performs an 'Evaluation-only pre-write safety check' and lists specific validations (AnchorID existence, confidence threshold, conflict resolution, canonical links). This clearly distinguishes it from sibling tools like ingest_record (actual writes) and guard_write_batch (batch operations).

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?

The description clearly establishes when to use the tool ('pre-write safety check') and explicitly states it 'does NOT perform any write,' implying the caller must use a separate write tool afterward. However, it does not explicitly name the specific sibling tool (likely ingest_record) to use for the actual write operation.

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