Skip to main content
Glama

guard_write_batch

Batch evaluate write permissions for up to 200 AnchorIDs. Returns per-item allowed or blocked decisions with conflict analysis to validate data safety before execution.

Instructions

Batch pre-write safety check for multiple AnchorIDs (max 200). Each item needs a client_ref for correlation. Returns per-item allowed/blocked decisions with reasons. Evaluation-only — never writes.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
itemsYesArray of guard/write requests

Implementation Reference

  • src/tools.ts:322-352 (registration)
    Tool registration for guard_write_batch - defines the tool name, description, and handler function
    // ─── 9. guard_write_batch ─────────────────────────────────────────
    server.tool(
      "guard_write_batch",
      "Batch pre-write safety check for multiple AnchorIDs (max 200). " +
        "Each item needs a client_ref for correlation. Returns per-item " +
        "allowed/blocked decisions with reasons. Evaluation-only — never writes.",
      {
        items: z
          .array(
            z.object({
              client_ref: z.string().describe("Your reference ID for correlation"),
              entity_id: z.string().describe("UUID of the AnchorID to evaluate"),
              min_confidence: z.number().min(0).max(1).optional(),
              require_no_conflicts: z.boolean().optional(),
            }),
          )
          .max(200)
          .describe("Array of guard/write requests"),
      },
      async (input) => {
        try {
          const data = await api.post(
            "/guard/write:batch",
            input as Record<string, unknown>,
          );
          return jsonContent(data);
        } catch (e) {
          return errorContent(e);
        }
      },
    );
  • Handler function that executes the tool logic - makes POST request to /guard/write:batch endpoint
    async (input) => {
      try {
        const data = await api.post(
          "/guard/write:batch",
          input as Record<string, unknown>,
        );
        return jsonContent(data);
      } catch (e) {
        return errorContent(e);
      }
    },
  • Zod schema definition for guard_write_batch input validation - defines the items array structure with up to 200 items
    {
      items: z
        .array(
          z.object({
            client_ref: z.string().describe("Your reference ID for correlation"),
            entity_id: z.string().describe("UUID of the AnchorID to evaluate"),
            min_confidence: z.number().min(0).max(1).optional(),
            require_no_conflicts: z.boolean().optional(),
          }),
        )
        .max(200)
        .describe("Array of guard/write requests"),
    },
  • Helper utilities used by the handler - jsonContent formats API responses, errorContent formats errors with isError flag
    /** Format the API response 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 full disclosure burden effectively. It explicitly states the read-only safety guarantee ('never writes'), describes the return value structure ('per-item allowed/blocked decisions with reasons'), and notes the correlation mechanism. Missing: specific error conditions or rate limiting details that would merit a 5.

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?

Four sentences, zero waste: (1) scope/limits, (2) required field semantics, (3) output description, (4) safety guarantee. Critical information is front-loaded ('Batch', 'max 200', 'pre-write'). Every sentence earns its place in guiding tool selection and invocation.

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?

No output schema exists, but the description compensates adequately by describing return values ('allowed/blocked decisions with reasons'). For a safety-critical validation tool with complex nested input (array of objects), the description covers essential behavioral constraints. Minor gap: doesn't describe error response format.

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. The description adds value by explaining the purpose of client_ref ('for correlation') rather than just its existence, and emphasizes the operational constraint ('max 200'). It could enhance further by explaining min_confidence or require_no_conflicts semantics, but exceeds baseline requirements.

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?

Excellent specificity: 'Batch pre-write safety check' provides exact verb (check), resource (AnchorIDs), and scope (batch, max 200). The phrase 'Evaluation-only — never writes' clearly distinguishes it from write-oriented siblings like ingest_record, while 'Batch' differentiates it from guard_write.

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?

Strong contextual guidance: 'pre-write safety check' establishes when to use (before writing), and 'Evaluation-only — never writes' clarifies when NOT to use (when actual persistence is needed). However, it doesn't explicitly name guard_write as the alternative for single-item checks or ingest_record for actual writes.

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