get_protocol_shell
Generate protocol shells for structured reasoning workflows in the Sutra MCP server, including pre-defined templates or custom shells with specified intents.
Instructions
Returns a Protocol Shell. Can return a specific pre-defined template or a blank shell.
Args:
name: The name of the protocol (e.g., 'reasoning.systematic') OR a custom name.
intent: (Optional) The intent if creating a custom shell.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | No | MyProtocol | |
| intent | No |
Implementation Reference
- The primary handler function for the 'get_protocol_shell' tool. It is registered via the @mcp.tool() decorator. Validates inputs using ProtocolShellInput, fetches predefined templates using get_protocol_template, or generates a generic shell using format_protocol_shell.@mcp.tool() def get_protocol_shell(name: str = "MyProtocol", intent: str | None = None) -> str: """ Returns a Protocol Shell. Can return a specific pre-defined template or a blank shell. Args: name: The name of the protocol (e.g., 'reasoning.systematic') OR a custom name. intent: (Optional) The intent if creating a custom shell. """ try: model = ProtocolShellInput(name=name, intent=intent) except ValidationError as e: return f"Input Validation Error: {e}" template = get_protocol_template(model.name) if template: return template intent_str = model.intent or "Define your intent here" return format_protocol_shell(name=model.name, intent=intent_str)
- Pydantic input schema model used for validating the tool's parameters: name and optional intent.class ProtocolShellInput(BaseModel): name: str = Field("MyProtocol", min_length=1, description="Protocol name.") intent: str | None = Field(None, description="Optional intent.")
- Helper function that formats a generic protocol shell template using the provided name and intent, formatting the PROTOCOL_SHELL_STRUCTURE string.def format_protocol_shell(name: str, intent: str) -> str: """Render a protocol shell with the provided name and intent. Args: name: Protocol identifier to append to `/protocol`. intent: Purpose statement describing the protocol's goal. Returns: Formatted protocol shell with placeholder input/output sections. """ return PROTOCOL_SHELL_STRUCTURE.format(name=name, intent=intent)
- Helper function that retrieves a predefined protocol template from the PROTOCOL_REGISTRY dictionary by its name.def get_protocol_template(name: str) -> Optional[str]: """Return a protocol template by name. Args: name: Key identifying the protocol in the registry. Returns: The matching protocol template, if present. """ return PROTOCOL_REGISTRY.get(name)
- src/context_engineering_mcp/server.py:246-266 (registration)The @mcp.tool() decorator registers the get_protocol_shell function as an MCP tool in the FastMCP server.@mcp.tool() def get_protocol_shell(name: str = "MyProtocol", intent: str | None = None) -> str: """ Returns a Protocol Shell. Can return a specific pre-defined template or a blank shell. Args: name: The name of the protocol (e.g., 'reasoning.systematic') OR a custom name. intent: (Optional) The intent if creating a custom shell. """ try: model = ProtocolShellInput(name=name, intent=intent) except ValidationError as e: return f"Input Validation Error: {e}" template = get_protocol_template(model.name) if template: return template intent_str = model.intent or "Define your intent here" return format_protocol_shell(name=model.name, intent=intent_str)