save_flow_model
Create or update a flow page block or model. Provide uid to update, or omit to create a new one. Specify component type with 'use' field.
Instructions
Create or update a flowPage block/model. If 'uid' is provided in values, it updates; otherwise creates a new one. The 'use' field specifies the component type (e.g. 'JSBlockModel', 'TableBlockModel'). NOTE: after creating, call attach_flow_model to make it appear on the page.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| values | Yes | Flow model data. Key fields: uid (optional), use (component type), parentId, subKey, subType, stepParams, sortIndex |
Implementation Reference
- src/index.ts:231-242 (registration)Registration of the 'save_flow_model' tool via server.registerTool() with name, schema, and handler.
server.registerTool( "save_flow_model", { description: "Create or update a flowPage block/model. If 'uid' is provided in values, it updates; otherwise creates a new one. The 'use' field specifies the component type (e.g. 'JSBlockModel', 'TableBlockModel'). NOTE: after creating, call attach_flow_model to make it appear on the page.", inputSchema: { values: JsonObject.describe("Flow model data. Key fields: uid (optional), use (component type), parentId, subKey, subType, stepParams, sortIndex"), }, }, // NocoBase assigns the entire body as ctx.action.params.values, so send data directly (no { values } wrapper) async ({ values }) => ok(await nocoFetch("/api/flowModels:save", { method: "POST", body: JSON.stringify(values) })) ); - src/index.ts:240-241 (handler)Handler function that POSTs to /api/flowModels:save with the provided values.
async ({ values }) => ok(await nocoFetch("/api/flowModels:save", { method: "POST", body: JSON.stringify(values) })) - src/index.ts:233-237 (schema)Input schema: description and inputSchema defining 'values' as a JSON object.
{ description: "Create or update a flowPage block/model. If 'uid' is provided in values, it updates; otherwise creates a new one. The 'use' field specifies the component type (e.g. 'JSBlockModel', 'TableBlockModel'). NOTE: after creating, call attach_flow_model to make it appear on the page.", inputSchema: { values: JsonObject.describe("Flow model data. Key fields: uid (optional), use (component type), parentId, subKey, subType, stepParams, sortIndex"), }, - src/index.ts:29-31 (helper)Helper function 'ok' that wraps data into the MCP content response format.
const ok = (data: unknown) => ({ content: [{ type: "text" as const, text: JSON.stringify(data, null, 2) }], });