batch_patch_ui_schema
Update multiple UI schema nodes in a single request by providing an array of patch objects, each identified by x-uid with the fields to update.
Instructions
Patch multiple UI schema nodes in a single request. Each object in the patches array must include 'x-uid' plus the fields to update.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| patches | Yes | Array of partial schema patch objects, each identified by x-uid |
Implementation Reference
- src/index.ts:141-151 (registration)Registration of the 'batch_patch_ui_schema' tool using server.registerTool, with description and inputSchema.
server.registerTool( "batch_patch_ui_schema", { description: "Patch multiple UI schema nodes in a single request. Each object in the patches array must include 'x-uid' plus the fields to update.", inputSchema: { patches: z.array(JsonObject).describe("Array of partial schema patch objects, each identified by x-uid"), }, }, async ({ patches }) => ok(await nocoFetch("/api/uiSchemas:batchPatch", { method: "POST", body: JSON.stringify(patches) })) ); - src/index.ts:149-151 (handler)Handler function that calls nocoFetch('/api/uiSchemas:batchPatch') with a POST method and the serialized patches array.
async ({ patches }) => ok(await nocoFetch("/api/uiSchemas:batchPatch", { method: "POST", body: JSON.stringify(patches) })) ); - src/index.ts:144-148 (schema)Input schema defining a 'patches' parameter as an array of JSON objects.
description: "Patch multiple UI schema nodes in a single request. Each object in the patches array must include 'x-uid' plus the fields to update.", inputSchema: { patches: z.array(JsonObject).describe("Array of partial schema patch objects, each identified by x-uid"), }, }, - src/index.ts:36-36 (helper)The JsonObject helper schema (z.record(z.string(), z.unknown())) reused for the patches array element type.
const JsonObject = z.record(z.string(), z.unknown()); - src/index.ts:18-27 (helper)The nocoFetch helper function used by the handler to make HTTP requests.
async function nocoFetch(path: string, options: RequestInit = {}): Promise<unknown> { const url = `${NOCOBASE_URL}${path}`; const res = await fetch(url, { ...options, headers: { ...reqHeaders, ...(options.headers as Record<string, string> | undefined) }, }); const text = await res.text(); if (!res.ok) throw new Error(`HTTP ${res.status} ${res.statusText}: ${text}`); try { return JSON.parse(text); } catch { return text; } }