Skip to main content
Glama
gerred

MCP Server Replicate

validate_template_parameters

Validate input parameters against a predefined template schema to ensure compatibility with AI model requirements before processing.

Instructions

Validate parameters against a template schema.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
inputYes

Implementation Reference

  • The core handler function for the 'validate_template_parameters' tool. It performs validation by instantiating the TemplateInput Pydantic model, which triggers field validators for template existence and parameter schema compliance.
    def validate_template_parameters(input: dict[str, Any]) -> bool:
        """Validate parameters against a template schema."""
        template_input = TemplateInput(**input)
        return True  # If we get here, validation passed
  • Pydantic model defining the input schema for the tool. Contains field validators that check if the template exists in TEMPLATES and validates parameters against the JSON schema defined in the template.
    class TemplateInput(BaseModel):
        """Input for template-based operations."""
    
        template: str = Field(..., description="Template identifier")
        parameters: dict[str, Any] = Field(default_factory=dict, description="Template parameters")
    
        @field_validator("template")
        def validate_template(cls, v: str) -> str:
            """Validate template identifier."""
            if v not in TEMPLATES:
                raise ValueError(f"Unknown template: {v}")
            return v
    
        @field_validator("parameters")
        def validate_parameters(cls, v: dict[str, Any], values: dict[str, Any]) -> dict[str, Any]:
            """Validate template parameters."""
            if "template" not in values:
                return v
    
            template = TEMPLATES[values["template"]]
            try:
                jsonschema.validate(v, template["parameter_schema"])
            except jsonschema.exceptions.ValidationError as e:
                raise ValueError(f"Invalid parameters: {e.message}") from e
            return v
  • Defines the TEMPLATES dictionary imported into server.py, which contains preset configurations used for template validation. Individual templates reference parameter_schema defined in other files.
    TEMPLATES: dict[str, dict[str, Any]] = {
        "quality": QUALITY_PRESETS,
        "style": STYLE_PRESETS,
        "aspect_ratio": ASPECT_RATIO_PRESETS,
        "negative_prompt": NEGATIVE_PROMPT_PRESETS,
    }
  • Aggregates all template definitions (including those with parameter_schema) into a single TEMPLATES dictionary, though server.py imports directly from common_configs.
    """Parameter templates for Replicate models."""
    
    from .common_configs import TEMPLATES as COMMON_TEMPLATES
    from .stable_diffusion import TEMPLATES as SD_TEMPLATES
    from .controlnet import TEMPLATES as CONTROLNET_TEMPLATES
    
    # Merge all templates
    TEMPLATES = {
        **COMMON_TEMPLATES,
        **SD_TEMPLATES,
        **CONTROLNET_TEMPLATES,
    }
    
    __all__ = ["TEMPLATES"] 
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the tool validates parameters, implying a read-only check, but doesn't specify if it returns validation results, errors, or success status, nor does it mention any side effects, permissions, or rate limits. This leaves the agent uncertain about the tool's behavior beyond its basic purpose.

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 extremely concise with a single sentence, 'Validate parameters against a template schema.', which is front-loaded and wastes no words. It efficiently conveys the core idea without unnecessary elaboration, making it easy to parse quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity of validation (involving parameters and schemas), no annotations, no output schema, and 1 parameter with 0% schema coverage, the description is incomplete. It doesn't explain what happens after validation, what the output might be, or how to interpret results, leaving significant gaps for the agent to operate effectively.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema description coverage is 0%, and the description adds minimal meaning beyond the schema. It mentions 'parameters' and 'template schema', which loosely relates to the 'input' parameter, but doesn't explain what 'input' should contain (e.g., parameters object and template reference) or the expected structure. With 1 parameter and low coverage, the description fails to compensate adequately.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description 'Validate parameters against a template schema' clearly states the tool's function (validation) and target (parameters and template schema), but it's vague about what 'template schema' refers to and doesn't distinguish it from sibling tools like 'list_templates' or 'create_prediction'. It provides a basic purpose without specificity.

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 is provided on when to use this tool versus alternatives. It doesn't mention prerequisites, such as needing a template from 'list_templates', or differentiate it from other validation-related operations that might be implied by siblings like 'create_prediction'. The description offers no context for usage decisions.

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/gerred/mcp-server-replicate'

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