Skip to main content
Glama

save_as_template

Save an existing UI schema node as a reusable block template by providing a UID and metadata such as name and collection.

Instructions

Save an existing UI schema node as a reusable block template

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
uidYesUI schema UID to save as template
valuesYesTemplate metadata (e.g. name, componentName, collectionName)

Implementation Reference

  • The handler function that executes the save_as_template tool logic. It makes a POST request to /api/uiSchemas:saveAsTemplate/{uid} with template metadata values.
      async ({ uid, values }) =>
        ok(await nocoFetch(`/api/uiSchemas:saveAsTemplate/${uid}`, {
          method: "POST",
          body: JSON.stringify({ values }),
        }))
    );
  • Input schema for save_as_template: requires uid (string) and values (record of unknown, i.e. JSON object) for template metadata.
    {
      description: "Save an existing UI schema node as a reusable block template",
      inputSchema: {
        uid: z.string().describe("UI schema UID to save as template"),
        values: JsonObject.describe("Template metadata (e.g. name, componentName, collectionName)"),
      },
  • src/index.ts:165-179 (registration)
    Registration of the 'save_as_template' tool on the MCP server via server.registerTool().
    server.registerTool(
      "save_as_template",
      {
        description: "Save an existing UI schema node as a reusable block template",
        inputSchema: {
          uid: z.string().describe("UI schema UID to save as template"),
          values: JsonObject.describe("Template metadata (e.g. name, componentName, collectionName)"),
        },
      },
      async ({ uid, values }) =>
        ok(await nocoFetch(`/api/uiSchemas:saveAsTemplate/${uid}`, {
          method: "POST",
          body: JSON.stringify({ values }),
        }))
    );
  • The nocoFetch helper function used by the handler to make HTTP requests to the NocoBase API backend.
    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?

No annotations are provided, so the description must fully disclose behavior. It mentions 'Save' (mutation) but lacks details on side effects, permissions, or whether the template is stored independently or modifies the source node. This is insufficient for safe and correct invocation.

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

Conciseness4/5

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

The description is a single sentence with no unnecessary words. It is concise but could be more informative without significant bloat.

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

Completeness2/5

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

Given the tool has a nested object parameter and no output schema, the description lacks explanation of what constitutes a 'reusable block template' or how the template is later used or retrieved. It does not address potential constraints or behavioral nuances, making it incomplete for complex usage scenarios.

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

Parameters3/5

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

Schema coverage is 100% with both parameters described. The description does not add new semantic information beyond the schema, which already specifies 'UI schema UID' and 'Template metadata (e.g. name, componentName, collectionName)'. With high schema coverage, a baseline of 3 is appropriate.

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 states 'Save an existing UI schema node as a reusable block template', which clearly identifies the verb, resource, and outcome. It distinguishes from sibling tools like 'save_ui_schema' or 'update_ui_schema' by specifying 'as a reusable block template'.

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 implies usage for creating templates but provides no explicit guidance on when to use this tool versus alternatives like 'save_flow_model' or 'insert_adjacent_schema'. No when-not-to-use or prerequisite information is given.

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