Skip to main content
Glama
RichFerry

Production MCP Template

by RichFerry

design_tool_contract

Read-onlyIdempotent

Generate a design-time contract preview for a future MCP tool, specifying its purpose, side effects, and authentication requirements to validate tool design before implementation.

Instructions

Generate a design-time contract preview for a future MCP tool.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
tool_nameYes
purposeYes
side_effectsNoread
auth_requiredNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
tool_nameYes
purposeYes
side_effectsYes
auth_requiredYes
recommended_annotationsYes
schema_sectionsYes
operational_guidanceYes

Implementation Reference

  • The async function `design_tool_contract` that implements the tool logic: generates a design-time contract preview for a future MCP tool based on tool_name, purpose, side_effects, and auth_required.
    async def design_tool_contract(
        tool_name: str,
        purpose: str,
        side_effects: Literal["none", "read", "write", "external-io"] = "read",
        auth_required: bool = False,
    ) -> ToolContractPreview:
        """Generate a design-time contract preview for a future MCP tool."""
        with container.metrics.observe_tool("design_tool_contract"):
            guidance = [
                "Define crisp input schema boundaries and validation failures.",
                "Return structured output instead of free-form text when clients may chain this tool.",
                "Document idempotency and side effects in the tool description.",
            ]
            if side_effects in {"write", "external-io"}:
                guidance.append("Add retries, timeout budgets, and audit logging before production rollout.")
            if auth_required:
                guidance.append("Gate the tool behind scopes that map to a specific trust boundary.")
            return ToolContractPreview(
                tool_name=tool_name,
                purpose=purpose,
                side_effects=side_effects,
                auth_required=auth_required,
                recommended_annotations={
                    "readOnlyHint": side_effects == "none",
                    "idempotentHint": side_effects in {"none", "read"},
                    "destructiveHint": side_effects == "write",
                    "openWorldHint": side_effects == "external-io",
                },
                schema_sections=["inputs", "validation", "structured_output", "error_contract"],
                operational_guidance=guidance,
            )
  • The `@server.tool` decorator registering the tool with name 'design_tool_contract' and annotations (readOnlyHint, idempotentHint).
    @server.tool(
        name="design_tool_contract",
        annotations=ToolAnnotations(readOnlyHint=True, idempotentHint=True, openWorldHint=False),
  • The `ToolContractPreview` Pydantic model defining the structured return type of the tool (tool_name, purpose, side_effects, auth_required, recommended_annotations, schema_sections, operational_guidance).
    class ToolContractPreview(TemplateModel):
        tool_name: str
        purpose: str
        side_effects: Literal["none", "read", "write", "external-io"]
        auth_required: bool
        recommended_annotations: dict[str, bool]
        schema_sections: list[str]
        operational_guidance: list[str]
  • The `register` function returns a ModuleDescriptor that lists 'design_tool_contract' among the tools provided by the 'design' module.
    return ModuleDescriptor(
        name="design",
        title="Design",
        summary="Future-facing design tools for elicitation, sampling, and capability planning.",
        tags=["planning", "elicitation", "sampling"],
        maturity="beta",
        tools=["design_collect_feature_brief", "design_tool_contract", "design_refine_with_sampling"],
        resources=["template://production-readiness", "template://module/{name}"],
        prompts=["design_rollout_plan"],
    )
Behavior3/5

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

Annotations indicate readOnlyHint and idempotentHint, which align with the description of generating a preview. However, the description adds no additional behavioral context beyond what annotations provide.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single sentence, concise but too terse given the tool's complexity (4 parameters, 0% schema coverage). It sacrifices completeness for brevity.

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?

While an output schema exists, the description does not explain the return values or the role of parameters. The tool deals with design-time contracts, but the description lacks details on what constitutes a contract, making it incomplete.

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

Parameters1/5

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

Schema description coverage is 0%, and the description does not mention any of the four parameters (tool_name, purpose, side_effects, auth_required). It adds no meaning beyond the schema.

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 'Generate' and the resource 'design-time contract preview for a future MCP tool', which is specific and distinct from sibling tools like design_collect_feature_brief and design_refine_with_sampling.

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 on when to use this tool versus alternatives. There is no mention of when not to use it or any prerequisites.

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/RichFerry/MCP-Template'

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