Skip to main content
Glama

get_template

Retrieve detailed information about a specific ComfyUI workflow template, including parameters, requirements, and DSL preview for workflow creation.

Instructions

Get detailed information about a specific template.

Retrieves complete template information including parameters, requirements, and DSL preview.

Args: template_name: Name of the template to retrieve

Returns: Template details with parameters and DSL preview

Examples: get_template("text2img_basic") get_template("controlnet_pose")

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
template_nameYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • MCP tool handler and registration for 'get_template'. Fetches template metadata via TemplateManager and returns it as a dictionary.
    @mcp.tool
    def get_template(template_name: str) -> dict:
        """Get detailed information about a specific template.
        
        Retrieves complete template information including parameters,
        requirements, and DSL preview.
        
        Args:
            template_name: Name of the template to retrieve
        
        Returns:
            Template details with parameters and DSL preview
        
        Examples:
            get_template("text2img_basic")
            get_template("controlnet_pose")
        """
        try:
            template_info = template_manager.get_template_info(template_name)
            
            if template_info is None:
                raise ToolError(f"Template '{template_name}' not found")
            
            return template_info
            
        except Exception as e:
            raise ToolError(f"Error getting template: {e}")
  • Core logic for retrieving template information from custom templates dictionary, extracting metadata, parameters, and DSL preview.
    def get_template_info(self, template_name: str) -> Optional[Dict[str, Any]]:
        """Get detailed information about a template."""
        template = self.custom_templates.get(template_name)
        if not template:
            return None
        
        return {
            "name": template_name,
            "description": template.description,
            "category": template.category,
            "tags": template.tags,
            "difficulty": template.difficulty,
            "required_models": template.required_models or [],
            "parameters": template.parameters or {},
            "parameter_placeholders": self._extract_parameters_from_dsl(template.dsl_content),
            "dsl_preview": template.dsl_content[:500] + "..." if len(template.dsl_content) > 500 else template.dsl_content
        }
Behavior3/5

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

With no annotations provided, the description carries the full burden. It states the tool retrieves information (implying read-only) and lists what's included (parameters, requirements, DSL preview), but doesn't disclose behavioral aspects like error handling, authentication needs, rate limits, or response format details beyond the high-level 'Template details'.

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 well-structured and front-loaded with the core purpose, followed by sections for Args, Returns, and Examples. Every sentence earns its place—no fluff or repetition—making it easy to scan and understand quickly.

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?

Given the tool's moderate complexity (single parameter, read operation) and the presence of an output schema (which handles return values), the description is largely complete. It covers purpose, parameter meaning, and examples, but could improve by addressing behavioral transparency gaps like error cases or usage guidelines vs. siblings.

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 description coverage is 0%, but the description compensates well by explaining the single parameter 'template_name' as 'Name of the template to retrieve' and providing concrete examples. This adds meaningful context beyond the bare schema, though it doesn't detail constraints like format or length.

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 specific action ('Get detailed information about a specific template') and resource ('template'), distinguishing it from siblings like list_templates (which lists multiple) or get_template_dsl (which focuses only on DSL). The verb 'retrieves' is precise and the scope is well-defined.

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 when detailed template info is needed, but doesn't explicitly state when to use this vs. alternatives like list_templates (for overview) or get_template_dsl (for DSL only). No exclusions or prerequisites are mentioned, leaving some ambiguity in tool selection.

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/christian-byrne/comfy-mcp'

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