guard_write_batch
Evaluate multiple proposed writes against AnchorIDs in batch. Get allowed or blocked decisions per item with reasons, enabling pre-write safety without actual writes.
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
| Name | Required | Description | Default |
|---|---|---|---|
| items | Yes | Array of guard/write requests |
Implementation Reference
- src/tools.ts:322-324 (registration)Tool registration: 'guard_write_batch' is registered via server.tool() with name 'guard_write_batch'.
// ─── 9. guard_write_batch ───────────────────────────────────────── server.tool( "guard_write_batch", - src/tools.ts:328-339 (schema)Input schema: Zod schema defining items as an array (max 200) of objects with client_ref, entity_id, min_confidence (optional), and require_no_conflicts (optional).
{ 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"), - src/tools.ts:341-351 (handler)Handler function: async callback that POSTs the input to /guard/write:batch via the ApiClient and returns the JSON result or error.
async (input) => { try { const data = await api.post( "/guard/write:batch", input as Record<string, unknown>, ); return jsonContent(data); } catch (e) { return errorContent(e); } }, - src/tools.ts:322-352 (helper)Full tool definition: registration (line 322-324), description (lines 325-327), schema (lines 328-339), and handler (lines 341-352).
// ─── 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); } }, ); - src/index.ts:25-25 (registration)Top-level registration entry point: registerTools(server) is called to register all tools including guard_write_batch.
registerTools(server);