get_template
Retrieve detailed information about a specific ComfyUI workflow template, including parameters, requirements, and DSL preview, to understand and use templates effectively.
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
| Name | Required | Description | Default |
|---|---|---|---|
| template_name | Yes |
Implementation Reference
- comfy_mcp/mcp/server.py:390-417 (handler)MCP tool handler for 'get_template'. Calls template_manager.get_template_info() and handles errors, decorated with @mcp.tool for registration.@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 helper function in TemplateManager that retrieves and formats detailed template information from custom_templates dict.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 }