insert_new_schema
Creates and inserts a new UI schema node into NocoBase. Provide a JSON schema to define the node's structure and placement.
Instructions
Create and insert a new UI schema node via NocoBase's insertNewSchema action
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| schema | Yes | Schema node to create and insert (JSON) |
Implementation Reference
- src/index.ts:104-106 (handler)The handler function for insert_new_schema: sends a POST request to /api/uiSchemas:insertNewSchema with the schema JSON body.
async ({ schema }) => ok(await nocoFetch("/api/uiSchemas:insertNewSchema", { method: "POST", body: JSON.stringify({ schema }) })) ); - src/index.ts:100-103 (schema)Input schema for insert_new_schema: a single 'schema' parameter of type JsonObject (record of string to unknown).
{ description: "Create and insert a new UI schema node via NocoBase's insertNewSchema action", inputSchema: { schema: JsonObject.describe("Schema node to create and insert (JSON)") }, }, - src/index.ts:98-106 (registration)Registration of insert_new_schema tool via server.registerTool() with name, description, input schema, and handler.
server.registerTool( "insert_new_schema", { description: "Create and insert a new UI schema node via NocoBase's insertNewSchema action", inputSchema: { schema: JsonObject.describe("Schema node to create and insert (JSON)") }, }, async ({ schema }) => ok(await nocoFetch("/api/uiSchemas:insertNewSchema", { method: "POST", body: JSON.stringify({ schema }) })) ); - src/index.ts:394-400 (registration)MANUAL_TOOLS set includes 'insert_new_schema' so it is skipped by dynamic tool registration from Swagger.
const MANUAL_TOOLS = new Set([ "list_collections","get_collection","list_pages","get_page", "get_parent_schema","create_page","insert_new_schema","insert_adjacent_schema", "update_ui_schema","batch_patch_ui_schema","remove_ui_schema","save_as_template", "list_desktop_routes","get_flow_model","get_flow_model_by_parent","save_flow_model", "attach_flow_model","move_flow_model","duplicate_flow_model","destroy_flow_model", "get_js_block","update_js_block", - src/index.ts:29-31 (helper)Helper function 'ok' used by the handler to format the response as text content.
const ok = (data: unknown) => ({ content: [{ type: "text" as const, text: JSON.stringify(data, null, 2) }], });