Skip to main content
Glama
restforge

@restforge-dev/mcp-server

Official
by restforge

Get Config Schema

setup_get_config_schema
Read-onlyIdempotent

Retrieve the JSON schema of all configurable db-connection.env parameters, including name, section, type, default value, description, and required status.

Instructions

Get JSON schema of all parameters available in db-connection.env template. Schema includes parameter name, section, type (string/integer/boolean), default value, description, and required status.

USE WHEN:

  • The agent needs to know what parameters are configurable before writing config

  • Listing available config options for user reference

  • Building a dynamic UI or validator from the schema

  • The user asks things like "what parameters are available", "list all config options", "parameter apa saja yang bisa di-set", "tampilkan schema config", "what can I configure", "show me the configurable fields", "field apa saja yang valid"

DO NOT USE FOR:

  • Reading actual current config values -> use 'setup_read_env'

  • Writing config -> use 'setup_write_env' or 'setup_update_env'

  • Getting raw template text -> use 'setup_get_init_template'

This tool runs: npx restforge-cli config:schema in the given cwd. The schema is sourced from restforge-cli (single source of truth) so it stays in sync with the restforge runtime version installed in the project. Requires restforgejs >= 2.3.1.

PRESENTATION GUIDANCE:

  • Match the user's language. If the user writes in Indonesian, respond in Indonesian.

  • Never mention internal tool names in the reply to the user. Describe actions by what they do (e.g. "install the package", "fill in the credentials").

  • Speak in plain language. Summarise the schema (number of parameters, sections present, key required fields); do not paste the entire JSON unless the user explicitly asks for it.

  • When a precondition is not met (e.g. the package is not installed), frame it as a question or next-step suggestion rather than an error.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
cwdYesAbsolute path of the project folder (must have restforgejs installed in node_modules)

Implementation Reference

  • Main handler function that registers the 'setup_get_config_schema' tool. Checks precondition (restforgejs installed), runs 'npx restforge-cli config:schema', parses JSON output, and returns formatted schema result.
    export function registerSetupGetConfigSchema(server: McpServer): void {
      server.registerTool(
        'setup_get_config_schema',
        {
          title: 'Get Config Schema',
          description: `Get JSON schema of all parameters available in db-connection.env template.
    Schema includes parameter name, section, type (string/integer/boolean), default value,
    description, and required status.
    
    USE WHEN:
    - The agent needs to know what parameters are configurable before writing config
    - Listing available config options for user reference
    - Building a dynamic UI or validator from the schema
    - The user asks things like "what parameters are available", "list all config options",
      "parameter apa saja yang bisa di-set", "tampilkan schema config", "what can I configure",
      "show me the configurable fields", "field apa saja yang valid"
    
    DO NOT USE FOR:
    - Reading actual current config values -> use 'setup_read_env'
    - Writing config -> use 'setup_write_env' or 'setup_update_env'
    - Getting raw template text -> use 'setup_get_init_template'
    
    This tool runs: npx restforge-cli config:schema in the given cwd.
    The schema is sourced from restforge-cli (single source of truth) so it stays
    in sync with the restforge runtime version installed in the project.
    Requires restforgejs >= 2.3.1.
    
    PRESENTATION GUIDANCE:
    - Match the user's language. If the user writes in Indonesian, respond in Indonesian.
    - Never mention internal tool names in the reply to the user. Describe actions by what they do (e.g. "install the package", "fill in the credentials").
    - Speak in plain language. Summarise the schema (number of parameters, sections present, key required fields); do not paste the entire JSON unless the user explicitly asks for it.
    - When a precondition is not met (e.g. the package is not installed), frame it as a question or next-step suggestion rather than an error.`,
          inputSchema: {
            cwd: z.string().min(1).describe('Absolute path of the project folder (must have restforgejs installed in node_modules)'),
          },
          annotations: {
            title: 'Get Config Schema',
            readOnlyHint: true,
            idempotentHint: true,
          },
        },
        async ({ cwd }) => {
          const projectCwd = resolve(cwd);
    
          // Precondition check: restforgejs must be installed before this CLI command can run.
          // Treated as a non-error precondition per the authoring guide §3.4.
          try {
            await access(join(projectCwd, 'node_modules', 'restforgejs'));
          } catch {
            return {
              content: [
                {
                  type: 'text',
                  text: `Precondition not met: the RESTForge package is not installed in this project.
    
    Project path: ${projectCwd}
    Expected location: node_modules/restforgejs
    
    For the assistant:
    - The schema can only be retrieved once the RESTForge package is installed locally.
    - Suggest installing the package first, then retry getting the schema.
    - When explaining to the user, say something like "the RESTForge package isn't installed yet — should I install it first?". Do not mention internal tool names.`,
                },
              ],
              isError: false, // per §3.4
            };
          }
    
          // Run subprocess with NODE_ENV=production to suppress legacy banner output
          const result = await execProcess(
            'npx',
            ['restforge-cli', 'config:schema'],
            {
              cwd: projectCwd,
              timeout: 15_000,
              env: { NODE_ENV: 'production' },
            }
          );
    
          // CLI failure: real error per §3.4; structured per §3.5.
          if (!result.success) {
            return {
              content: [
                {
                  type: 'text',
                  text: `Failed to retrieve the configuration schema.
    
    Project path: ${projectCwd}
    Command: ${result.command}
    Exit code: ${result.exitCode}
    
    --- CLI output ---
    stdout:
    ${result.stdout}
    
    stderr:
    ${result.stderr}
    --- end CLI output ---
    
    For the assistant:
    - Tell the user that the schema could not be retrieved.
    - A common cause is an older RESTForge version that does not yet expose the schema command (requires restforgejs >= 2.3.1). Suggest upgrading the package as a likely fix.
    - Do not paste the raw stdout/stderr unless the user explicitly asks. Do not mention internal tool names.`,
                },
              ],
              isError: true, // per §3.4
            };
          }
    
          // Validate JSON output. Parse failure is a real error per §3.4 (CLI succeeded but produced invalid output).
          let parsed: unknown;
          try {
            parsed = JSON.parse(result.stdout);
          } catch (err) {
            const msg = err instanceof Error ? err.message : String(err);
            return {
              content: [
                {
                  type: 'text',
                  text: `Failed to parse the schema JSON returned by the CLI.
    
    Project path: ${projectCwd}
    Reason: ${msg}
    
    --- Raw stdout ---
    ${result.stdout}
    --- end Raw stdout ---
    
    For the assistant:
    - The CLI returned output that is not valid JSON.
    - Summarise this to the user in plain language; do not paste the raw stdout unless they explicitly ask.
    - Suggest checking that the installed package version is compatible (requires restforgejs >= 2.3.1). Do not mention internal tool names.`,
                },
              ],
              isError: true, // per §3.4
            };
          }
    
          // Re-stringify for consistent pretty formatting
          const prettyJson = JSON.stringify(parsed, null, 2);
    
          // Success: one-line summary + labeled facts + fenced JSON output per §3.5.
          return {
            content: [
              {
                type: 'text',
                text: `Configuration schema retrieved successfully.
    
    Project path: ${projectCwd}
    Source: restforge-cli (single source of truth for the installed runtime version)
    
    --- Schema (JSON) ---
    ${prettyJson}
    --- end Schema (JSON) ---
    
    For the assistant:
    - Confirm to the user that the schema is available.
    - Summarise in plain language: how many parameters there are, which sections are present (e.g. database, license, optional Live Sync / Redis / Kafka / Logging), and which fields are required.
    - Do not paste the full JSON block unless the user explicitly asks for it. Do not mention internal tool names.`,
              },
            ],
          };
        }
      );
  • Input schema definition using Zod: requires a single 'cwd' (string) parameter. Annotations mark the tool as read-only and idempotent.
    inputSchema: {
      cwd: z.string().min(1).describe('Absolute path of the project folder (must have restforgejs installed in node_modules)'),
    },
    annotations: {
      title: 'Get Config Schema',
      readOnlyHint: true,
      idempotentHint: true,
    },
  • Registration entry point: exports registerSetupTools which calls registerSetupGetConfigSchema(server) as part of setup tool registration.
    export function registerSetupTools(server: McpServer): void {
      registerSetupCreateFolder(server);
      registerSetupInstallPackage(server);
      registerSetupInitConfig(server);
      registerSetupWriteEnv(server);
      registerSetupReadEnv(server);
      registerSetupUpdateEnv(server);
      registerSetupValidateConfig(server);
      registerSetupGetConfigSchema(server);
      registerSetupGetInitTemplate(server);
    }
  • Helper execProcess used by the handler to run 'npx restforge-cli config:schema' as a subprocess with timeout and structured result.
    export async function execProcess(
      command: string,
      args: string[],
      options: ExecOptions = {}
    ): Promise<ExecResult> {
      const { cwd = process.cwd(), timeout = 60_000, env, stripFinalNewline = true } = options;
      const fullCommand = `${command} ${args.join(' ')}`;
    
      // Merge env: parent env first, custom env overrides
      const mergedEnv = env ? { ...process.env, ...env } : undefined;
    
      try {
        const result = await execa(command, args, {
          cwd,
          timeout,
          reject: false,
          stripFinalNewline,
          ...(mergedEnv ? { env: mergedEnv } : {}),
        });
        return {
          success: result.exitCode === 0,
          stdout: result.stdout,
          stderr: result.stderr,
          exitCode: result.exitCode ?? -1,
          command: fullCommand,
        };
      } catch (error) {
        const e = error as ExecaError;
        return {
          success: false,
          stdout: e.stdout?.toString() ?? '',
          stderr: e.stderr?.toString() ?? e.message,
          exitCode: e.exitCode ?? -1,
          command: fullCommand,
        };
      }
    }
Behavior4/5

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

Annotations already indicate read-only and idempotent. The description adds operational details (command execution, version requirement) and data freshness (single source of truth). No contradictions.

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?

Well-structured with clear sections, but the presentation guidance adds length. Could be slightly more concise, but overall effective.

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

Completeness5/5

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

Given the tool's simplicity (one param, no output schema), the description covers purpose, usage, prerequisites, and even response formatting. Fully complete for the context.

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 a description for the cwd parameter. The description does not add new meaning beyond the schema, so baseline 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 clearly states it fetches the JSON schema of config parameters, with a specific verb and resource. It distinguishes from sibling tools like setup_read_env and setup_write_env.

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

Usage Guidelines5/5

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

Explicit USE WHEN and DO NOT USE FOR sections list scenarios and alternatives, providing clear guidance for when to use this tool versus others.

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/restforge/restforge-mcp'

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