update_ui_schema
Perform partial updates to a UI schema node using its UID. Specify the schema UID and a JSON object with the fields to change.
Instructions
Patch an existing UI schema node by UID (partial update)
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| uid | Yes | UI schema UID | |
| patch | Yes | Partial schema fields to update (JSON) |
Implementation Reference
- src/index.ts:127-138 (registration)Registration of the 'update_ui_schema' tool via server.registerTool, including its input schema (uid, patch) and handler logic.
server.registerTool( "update_ui_schema", { description: "Patch an existing UI schema node by UID (partial update)", inputSchema: { uid: z.string().describe("UI schema UID"), patch: JsonObject.describe("Partial schema fields to update (JSON)"), }, }, async ({ uid, patch }) => ok(await nocoFetch(`/api/uiSchemas:patch`, { method: "POST", body: JSON.stringify({ ...patch, "x-uid": uid }) })) ); - src/index.ts:136-137 (handler)Handler function for update_ui_schema that calls nocoFetch('POST /api/uiSchemas:patch') with the patch data including x-uid.
async ({ uid, patch }) => ok(await nocoFetch(`/api/uiSchemas:patch`, { method: "POST", body: JSON.stringify({ ...patch, "x-uid": uid }) })) - src/index.ts:129-134 (schema)Input schema for update_ui_schema requiring a uid (string) and patch (JSON object) for partial updates.
{ description: "Patch an existing UI schema node by UID (partial update)", inputSchema: { uid: z.string().describe("UI schema UID"), patch: JsonObject.describe("Partial schema fields to update (JSON)"), }, - src/index.ts:29-31 (helper)Helper function 'ok' that wraps data into MCP content response format (used by the handler).
const ok = (data: unknown) => ({ content: [{ type: "text" as const, text: JSON.stringify(data, null, 2) }], }); - src/index.ts:18-27 (helper)Helper function 'nocoFetch' that makes HTTP requests to the NocoBase API (used by the handler).
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; } }