Skip to main content
Glama

get_workflow_template

Retrieve a saved workflow template's JSON and metadata by specifying the template name. Use this to load predefined ComfyUI workflows for reuse.

Instructions

Fetch a saved workflow template's JSON and metadata.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYesTemplate name.

Implementation Reference

  • Registration of the 'get_workflow_template' tool on the MCP server using server.tool().
    server.tool(
      "get_workflow_template",
      "Fetch a saved workflow template's JSON and metadata.",
      getSchema,
      async (args) => {
        validateName(args.name);
        let raw: string;
        try {
          raw = await fs.readFile(templatePath(store.dir, args.name), "utf-8");
        } catch {
          throw new Error(`Template "${args.name}" not found.`);
        }
        return {
          content: [{ type: "text" as const, text: raw }],
        };
      },
    );
  • Handler function for get_workflow_template: validates name, reads the JSON file from the template store directory, and returns the raw text content.
    async (args) => {
      validateName(args.name);
      let raw: string;
      try {
        raw = await fs.readFile(templatePath(store.dir, args.name), "utf-8");
      } catch {
        throw new Error(`Template "${args.name}" not found.`);
      }
      return {
        content: [{ type: "text" as const, text: raw }],
      };
    },
  • Input schema for get_workflow_template: requires a 'name' string parameter.
    const getSchema = {
      name: z.string().describe("Template name."),
    };
  • Helper function templatePath that constructs the file path by joining the store directory with the template name plus '.json'.
    function templatePath(dir: string, name: string): string {
      return path.join(dir, `${name}.json`);
    }
  • Helper function validateName that validates the template name against the allowed pattern.
    function validateName(name: string): void {
      if (!TEMPLATE_NAME_PATTERN.test(name)) {
        throw new Error(
          `Invalid template name "${name}". Must start with alphanumeric; only letters, digits, '-', '_' allowed; max 64 chars.`,
        );
      }
    }
Behavior2/5

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

No annotations exist, so description must fully disclose behavior. It only states the action but does not mention read-only nature, error handling (e.g., template not found), or any side effects.

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?

Single sentence, no wasted words, front-loaded with verb and resource.

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 simple fetch with one required parameter and no output schema, the description is mostly complete. However, it could briefly mention what metadata is returned or behavior on missing template.

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 one parameter 'name' described as 'Template name.' The description adds no extra semantic information beyond what the schema already provides.

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 verb 'fetch' and the resource 'saved workflow template's JSON and metadata'. It distinguishes effectively from sibling tools like list_workflow_templates (which lists all), save/delete/run templates.

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 on when to use this tool versus alternatives such as list_workflow_templates for listing, or run_workflow_template for execution. Missing context about prerequisites 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

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/miller-joe/comfyui-mcp'

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