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

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
        }

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