Skip to main content
Glama

get_template_dsl

Retrieve DSL content for ComfyUI templates to modify or execute workflows. Specify template name and source to access custom or official workflow definitions.

Instructions

Get DSL content for any template (custom or official).

Retrieves the DSL representation of a template, which can then be modified or executed directly.

Args: template_name: Name of the template source: Template source ("custom", "official", or "auto")

Returns: Template DSL content and metadata

Examples: get_template_dsl("text2img_basic") get_template_dsl("openai_dalle_3_text_to_image", "official")

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
template_nameYes
sourceNoauto

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The core handler function for the 'get_template_dsl' MCP tool, decorated with @mcp.tool. It generates DSL workflow content from a template using template_manager and returns it with metadata.
    @mcp.tool
    def get_template_dsl(template_name: str, source: str = "auto") -> dict:
        """Get DSL content for any template (custom or official).
        
        Retrieves the DSL representation of a template, which can then
        be modified or executed directly.
        
        Args:
            template_name: Name of the template
            source: Template source ("custom", "official", or "auto")
        
        Returns:
            Template DSL content and metadata
        
        Examples:
            get_template_dsl("text2img_basic")
            get_template_dsl("openai_dalle_3_text_to_image", "official")
        """
        try:
            # Try to get DSL content
            dsl_content = template_manager.generate_workflow(
                template_name, 
                parameters=None,
                source=source
            )
            
            if dsl_content is None:
                raise ToolError(f"Template '{template_name}' not found or has no DSL content")
            
            # Get template metadata
            template_info = None
            if source in ["auto", "custom"]:
                template_info = template_manager.get_template_info(template_name)
            
            if not template_info and source in ["auto", "official"]:
                official_template = template_manager.get_official_template(template_name)
                if official_template:
                    template_info = {
                        "name": template_name,
                        "display_name": official_template.name,
                        "description": official_template.description,
                        "category": official_template.category,
                        "source": "official",
                        "source_url": official_template.source_url,
                        "preview_images": official_template.preview_images or []
                    }
            
            return {
                "template_name": template_name,
                "dsl_content": dsl_content,
                "metadata": template_info or {},
                "source": source
            }
            
        except Exception as e:
            raise ToolError(f"Error getting template DSL: {e}")
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 discloses that the tool retrieves DSL content and metadata, which is useful behavioral context. However, it doesn't mention potential limitations like rate limits, authentication needs, error conditions, or whether the operation is idempotent. For a read operation with no annotations, this is adequate but leaves gaps in behavioral understanding.

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 front-loaded with the core purpose, followed by clear sections for Args, Returns, and Examples. Each sentence earns its place: the first states what it does, the second explains the use case, and the structured sections provide actionable details without redundancy. It's efficiently sized for the tool's complexity.

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 has an output schema (so return values are documented elsewhere), no annotations, and moderate complexity with 2 parameters, the description is reasonably complete. It covers purpose, parameters, and usage context. However, for a tool with 0% schema coverage and no annotations, it could better address behavioral aspects like error handling or performance characteristics to be fully comprehensive.

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%, so the description must compensate. It adds meaning by explaining template_name as 'Name of the template' and source with its possible values ('custom', 'official', or 'auto'), which clarifies beyond the bare schema. However, it doesn't detail format constraints for template_name or the implications of 'auto' vs. explicit sources, leaving some semantic gaps.

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 'Get' and resource 'DSL content for any template', specifying both custom and official templates. It distinguishes from siblings like get_template (likely returns different metadata), list_templates (lists rather than retrieves content), and execute_workflow (executes rather than retrieves). The purpose is specific and well-differentiated.

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 for retrieving DSL content that can be modified or executed, suggesting it's a precursor to tools like generate_from_template or write_workflow. However, it lacks explicit guidance on when to use this vs. alternatives like get_template (which might return different data) or read_workflow (which might handle workflows vs. templates). No when-not-to-use or prerequisite information is provided.

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