Skip to main content
Glama

update_flow_js_block

Update JavaScript code of a flow page JS block. The code runs in a NocoBase sandbox and uses ctx.render(htmlString) to render output.

Instructions

Update the JavaScript code of a JSBlockModel inside a flowPage. Code runs in NocoBase sandbox — use ctx.render(htmlString) to render output. Example: ctx.render(<h1>Hello</h1>);

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
uidYesFlow model UID of the JS block (JSBlockModel)
codeYesJavaScript code using ctx.render(htmlString) sandbox API

Implementation Reference

  • src/index.ts:367-390 (registration)
    Registration of 'update_flow_js_block' tool using server.registerTool().
    server.registerTool(
      "update_flow_js_block",
      {
        description: "Update the JavaScript code of a JSBlockModel inside a flowPage. Code runs in NocoBase sandbox — use ctx.render(htmlString) to render output. Example: ctx.render(`<h1>Hello</h1>`);",
        inputSchema: {
          uid: z.string().describe("Flow model UID of the JS block (JSBlockModel)"),
          code: z.string().describe("JavaScript code using ctx.render(htmlString) sandbox API"),
        },
      },
      async ({ uid, code }) =>
        ok(
          await nocoFetch("/api/flowModels:save", {
            method: "POST",
            body: JSON.stringify({
              uid,
              stepParams: {
                jsSettings: {
                  runJs: { code, version: "v2" },
                },
              },
            }),
          })
        )
    );
  • Input schema for update_flow_js_block: expects 'uid' (flow model UID of JSBlockModel) and 'code' (JavaScript using ctx.render sandbox API).
    description: "Update the JavaScript code of a JSBlockModel inside a flowPage. Code runs in NocoBase sandbox — use ctx.render(htmlString) to render output. Example: ctx.render(`<h1>Hello</h1>`);",
    inputSchema: {
      uid: z.string().describe("Flow model UID of the JS block (JSBlockModel)"),
      code: z.string().describe("JavaScript code using ctx.render(htmlString) sandbox API"),
    },
  • Handler (async function) that sends a POST to /api/flowModels:save with uid and stepParams.jsSettings.runJs containing the code and version 'v2'.
    async ({ uid, code }) =>
      ok(
        await nocoFetch("/api/flowModels:save", {
          method: "POST",
          body: JSON.stringify({
            uid,
            stepParams: {
              jsSettings: {
                runJs: { code, version: "v2" },
              },
            },
          }),
        })
      )
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description discloses that code runs in a NocoBase sandbox requiring ctx.render(htmlString), which is essential behavioral context. It could also mention that the code fully replaces existing code, but the main behavior is covered.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two sentences deliver purpose and key behavioral info with a code example, no unnecessary words. Front-loaded with the core action.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a 2-parameter tool with no output schema, the description covers purpose, sandbox behavior, and a usage example. It could mention return value or that the update is persistent, but it is largely complete.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema already describes both parameters with 100% coverage, so the description adds value by providing a concrete sandbox example and clarifying the render API, going beyond the schema definitions.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool updates JavaScript code of a JSBlockModel inside a flowPage, distinguishing it from sibling update_js_block by specifying the flowPage context.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage for flowPage JS blocks by mentioning the sandbox and giving an example, but it does not explicitly state when to use this tool over alternatives like update_js_block.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/puguhsudarma/nocobase-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server