Skip to main content
Glama
progress-all

ACOMO MCP Server

by progress-all

Generate API request template

generate_request_template

Create path, query, and body templates for ACOMO API requests using operationId. Simplifies API interaction by generating structured request formats for backend services.

Instructions

operationIdからpath/query/body雛形を生成

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
operationIdYes

Implementation Reference

  • The handler function for the 'generate_request_template' tool. It fetches the operation schemas using getOperationSchemas and generates the request template using buildRequestTemplate, then returns it as JSON text content.
    async ({ operationId }: { operationId: string }) => {
      const schemas = await getOperationSchemas(operationId);
      if (!schemas)
        return {
          content: [
            { type: "text", text: `Unknown operationId: ${operationId}` },
          ],
          isError: true,
        };
      const tmpl = buildRequestTemplate(schemas);
      return {
        content: [
          { type: "text", text: JSON.stringify(tmpl, null, 2) },
        ],
      };
    }
  • The input schema definition for the tool, specifying 'operationId' as a required string using Zod validation.
    {
      title: "Generate API request template",
      description: "operationIdからpath/query/body雛形を生成",
      inputSchema: { operationId: z.string() },
    },
  • src/server.ts:114-137 (registration)
    The registration of the 'generate_request_template' tool with the MCP server, including title, description, input schema, and handler function.
    server.registerTool(
      "generate_request_template",
      {
        title: "Generate API request template",
        description: "operationIdからpath/query/body雛形を生成",
        inputSchema: { operationId: z.string() },
      },
      async ({ operationId }: { operationId: string }) => {
        const schemas = await getOperationSchemas(operationId);
        if (!schemas)
          return {
            content: [
              { type: "text", text: `Unknown operationId: ${operationId}` },
            ],
            isError: true,
          };
        const tmpl = buildRequestTemplate(schemas);
        return {
          content: [
            { type: "text", text: JSON.stringify(tmpl, null, 2) },
          ],
        };
      }
    );
  • Core helper function that builds the request template object from operation schemas, extracting path/query params and generating body skeleton.
    export function buildRequestTemplate(opSchemas: {
      operationId: string;
      method: string;
      path: string;
      parameters: any[];
      requestBody?: any;
    }) {
      const pathParams: Record<string, string> = {};
      const query: Record<string, any> = {};
      for (const p of opSchemas.parameters ?? []) {
        if (p.in === 'path') pathParams[p.name] = `<${p.name}>`;
        if (p.in === 'query') query[p.name] = `<${p.name}>`;
      }
      const body = opSchemas.requestBody ? buildBodySkeleton(opSchemas.requestBody) : undefined;
      return {
        operationId: opSchemas.operationId,
        method: opSchemas.method,
        path: opSchemas.path,
        pathParams,
        query: Object.keys(query).length ? query : undefined,
        body,
      };
    }
  • Helper function that retrieves detailed schemas for parameters, requestBody, and responses for a given operationId, used by the tool handler.
    export async function getOperationSchemas(operationId: string): Promise<{
      operationId: string;
      method: string;
      path: string;
      parameters: any[]; // path/query/header
      requestBody?: any; // schema if available
      responses?: Record<string, any>; // status -> schema/desc
    } | null> {
      const found = await findOperationById(operationId);
      if (!found) return null;
      const op = found.raw || {};
      const parameters = op.parameters ?? [];
      let requestBody: any | undefined;
      if (op.requestBody?.content) {
        // prefer application/json
        const json = op.requestBody.content['application/json'] || Object.values(op.requestBody.content)[0];
        requestBody = json?.schema ?? json;
      }
      const responses: Record<string, any> = {};
      if (op.responses) {
        for (const [code, res] of Object.entries(op.responses)) {
          const content = (res as any)?.content;
          const json = content?.['application/json'] || (content && Object.values(content)[0]);
          responses[code] = json?.schema ?? (res as any)?.description ?? res;
        }
      }
      return {
        operationId,
        method: found.method,
        path: found.path,
        parameters,
        requestBody,
        responses,
      };
    }
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions generating templates but doesn't specify what the output looks like (e.g., format, structure), whether it's a read-only operation, or any constraints like rate limits. This leaves gaps in understanding the tool's behavior beyond the basic action.

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

Conciseness3/5

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

The description is a single, concise sentence in Japanese, which is efficient. However, it lacks front-loading of key details and could be more structured to highlight purpose and usage. While not verbose, it under-specifies, making it less helpful than it could be with slightly more elaboration.

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 complexity of generating API templates, no annotations, no output schema, and low parameter coverage, the description is incomplete. It doesn't explain the output format, error conditions, or how the tool interacts with siblings like 'list_apis.' For a tool that likely produces structured data, this leaves significant gaps in contextual understanding.

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

Parameters2/5

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

The input schema has 1 parameter with 0% description coverage, so the description must compensate. It only mentions 'operationId' without explaining what it is, where to get it, or its expected format. This adds minimal meaning beyond the schema, failing to address the coverage gap adequately.

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

Purpose4/5

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

The description states a clear purpose: generating API request templates (path/query/body) from an operationId. It specifies the verb 'generate' and resource 'API request template,' though it doesn't explicitly differentiate from sibling tools like 'call_api' or 'describe_api.' The Japanese text is understandable but could be more precise about what '雛形' (template) entails.

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

Usage Guidelines2/5

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

No guidance is provided on when to use this tool versus alternatives. It doesn't mention prerequisites, such as needing an operationId from another tool like 'list_apis' or 'describe_api,' or contrast with siblings like 'call_api' for actual execution. The description implies usage but offers no explicit context or exclusions.

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

Related 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/progress-all/acomo-mcp-server'

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