get_js_block
Fetches a JS block UI schema using its UID, designed for classic 'page' type pages.
Instructions
Get a JS block UI schema by UID (for classic 'page' type pages, not flowPage)
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| uid | Yes | UI schema UID of the JS block |
Implementation Reference
- src/index.ts:336-344 (handler)The handler function for get_js_block tool. Fetches a JS block UI schema by UID via /api/uiSchemas/{uid}, extracts the schema data, checks if it's a jsBlock (x-component=CustomRequestBlock or type=jsBlock), and returns a note if it may not be a jsBlock. Returns JSON-stringified data.
async ({ uid }) => { const data = await nocoFetch(`/api/uiSchemas/${uid}`); const schema = ((data as { data?: Record<string, unknown> })?.data ?? data) as Record<string, unknown>; const note = schema?.["x-component"] !== "CustomRequestBlock" && schema?.["type"] !== "jsBlock" ? "Note: schema type may not be jsBlock.\n\n" : ""; return { content: [{ type: "text" as const, text: `${note}${JSON.stringify(data, null, 2)}` }] }; } - src/index.ts:334-334 (schema)Input schema for get_js_block: expects a single 'uid' string parameter describing the UI schema UID of the JS block.
inputSchema: { uid: z.string().describe("UI schema UID of the JS block") }, - src/index.ts:329-345 (registration)Registration of the 'get_js_block' tool using server.registerTool() with description, inputSchema (Zod), and async handler. Also listed in the MANUAL_TOOLS set (line 400) to avoid duplication with dynamic tools from OpenAPI.
// 22. get_js_block server.registerTool( "get_js_block", { description: "Get a JS block UI schema by UID (for classic 'page' type pages, not flowPage)", inputSchema: { uid: z.string().describe("UI schema UID of the JS block") }, }, async ({ uid }) => { const data = await nocoFetch(`/api/uiSchemas/${uid}`); const schema = ((data as { data?: Record<string, unknown> })?.data ?? data) as Record<string, unknown>; const note = schema?.["x-component"] !== "CustomRequestBlock" && schema?.["type"] !== "jsBlock" ? "Note: schema type may not be jsBlock.\n\n" : ""; return { content: [{ type: "text" as const, text: `${note}${JSON.stringify(data, null, 2)}` }] }; } );