Skip to main content
Glama

insert_adjacent_schema

Insert a new UI schema node at a specified position relative to a target node: before, after, as first child, or as last child.

Instructions

Insert a schema node at a position relative to a target node. Position values: beforeBegin (prev sibling), afterBegin (first child), beforeEnd (last child), afterEnd (next sibling)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
uidYesTarget UI schema UID to insert relative to
schemaYesNew schema node to insert (JSON)
positionYesInsert position relative to the target node

Implementation Reference

  • src/index.ts:108-124 (registration)
    Registration of the insert_adjacent_schema tool on the McpServer. This is where the tool is registered with its name, input schema, and handler.
    // 9. insert_adjacent_schema
    server.registerTool(
      "insert_adjacent_schema",
      {
        description: "Insert a schema node at a position relative to a target node. Position values: beforeBegin (prev sibling), afterBegin (first child), beforeEnd (last child), afterEnd (next sibling)",
        inputSchema: {
          uid: z.string().describe("Target UI schema UID to insert relative to"),
          schema: JsonObject.describe("New schema node to insert (JSON)"),
          position: z.enum(["beforeBegin", "afterBegin", "beforeEnd", "afterEnd"]).describe("Insert position relative to the target node"),
        },
      },
      async ({ uid, schema, position }) =>
        ok(await nocoFetch(`/api/uiSchemas:insertAdjacent/${uid}`, {
          method: "POST",
          body: JSON.stringify({ schema, position }),
        }))
    );
  • The handler function for inserd_adjacent_schema. It takes uid, schema, and position parameters and makes an HTTP POST request to /api/uiSchemas:insertAdjacent/{uid} with the schema and position in the body.
      async ({ uid, schema, position }) =>
        ok(await nocoFetch(`/api/uiSchemas:insertAdjacent/${uid}`, {
          method: "POST",
          body: JSON.stringify({ schema, position }),
        }))
    );
  • Input schema definition for the insert_adjacent_schema tool. Defines three parameters: uid (string), schema (arbitrary JSON object), and position (enum of beforeBegin/afterBegin/beforeEnd/afterEnd).
    inputSchema: {
      uid: z.string().describe("Target UI schema UID to insert relative to"),
      schema: JsonObject.describe("New schema node to insert (JSON)"),
      position: z.enum(["beforeBegin", "afterBegin", "beforeEnd", "afterEnd"]).describe("Insert position relative to the target node"),
    },
  • Helper function that wraps data into an MCP content result with JSON-formatted text.
    const ok = (data: unknown) => ({
      content: [{ type: "text" as const, text: JSON.stringify(data, null, 2) }],
    });
  • Helper function used by the handler to make authenticated HTTP requests to the NocoBase API.
    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; }
    }
Behavior2/5

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

With no annotations, the description carries full burden but only describes the insertion mechanics. It does not disclose side effects, error behavior, permissions, or what happens if the target UID is invalid.

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?

The description is one sentence plus a concise listing of positions, with no fluff. It is front-loaded with the main action.

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

Completeness3/5

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

The description covers purpose and positions, but lacks details on return value, validation, or success/failure behavior, which would help given the schema has nested objects and no output schema.

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?

Schema coverage is 100% with descriptions; the tool description adds value by explaining the four position values in plain language, which complements the enum in the schema.

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 action (insert) and the resource (schema node relative to a target), distinguishing it from siblings like insert_new_schema which likely inserts without relative positioning.

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

Usage Guidelines3/5

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

The description explains the meaning of each position value, but does not explicitly state when to use this tool versus alternatives (e.g., insert_new_schema, update_ui_schema) or when not to use it.

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