move_flow_model
Relocates a flow model to a specified position relative to another block. Provide source and target UIDs and the target index.
Instructions
Move a flowPage block/model to a different position relative to another block.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sourceId | Yes | UID of the flow model to move | |
| targetId | Yes | UID of the target flow model (reference position) | |
| position | No | Target sort position index |
Implementation Reference
- src/index.ts:265-281 (registration)Registration of the 'move_flow_model' tool with MCP server, including its input schema (sourceId, targetId, position) and handler that calls the /api/flowModels:move API endpoint.
// 19. move_flow_model server.registerTool( "move_flow_model", { description: "Move a flowPage block/model to a different position relative to another block.", inputSchema: { sourceId: z.string().describe("UID of the flow model to move"), targetId: z.string().describe("UID of the target flow model (reference position)"), position: z.number().optional().describe("Target sort position index"), }, }, async ({ sourceId, targetId, position }) => { const qs = new URLSearchParams({ sourceId, targetId }); if (position !== undefined) qs.set("position", String(position)); return ok(await nocoFetch(`/api/flowModels:move?${qs}`, { method: "POST" })); } ); - src/index.ts:276-279 (handler)Handler function that constructs query params from sourceId, targetId, and optional position, then POSTs to /api/flowModels:move.
async ({ sourceId, targetId, position }) => { const qs = new URLSearchParams({ sourceId, targetId }); if (position !== undefined) qs.set("position", String(position)); return ok(await nocoFetch(`/api/flowModels:move?${qs}`, { method: "POST" })); - src/index.ts:268-274 (schema)Input schema definition for the move_flow_model tool with sourceId (required string), targetId (required string), and position (optional number).
{ description: "Move a flowPage block/model to a different position relative to another block.", inputSchema: { sourceId: z.string().describe("UID of the flow model to move"), targetId: z.string().describe("UID of the target flow model (reference position)"), position: z.number().optional().describe("Target sort position index"), }, - src/index.ts:18-27 (helper)Helper function nocoFetch that makes authenticated HTTP requests to the NocoBase API, used by the tool handler to call /api/flowModels:move.
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; } }