get_prompt_program
Generate pseudo-code prompt templates for math or debate programs to structure LLM reasoning workflows in the Sutra MCP server.
Instructions
Returns a functional pseudo-code prompt template (Module 07).
Args:
program_type: The type of program ('math', 'debate').
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| program_type | No | math |
Implementation Reference
- The primary handler function for the get_prompt_program tool. Decorated with @mcp.tool() which handles registration in the MCP server. Performs input validation and retrieves the appropriate prompt program template.@mcp.tool() def get_prompt_program(program_type: str = "math") -> str: """ Returns a functional pseudo-code prompt template (Module 07). Args: program_type: The type of program ('math', 'debate'). """ try: model = PromptProgramInput(program_type=program_type) except ValidationError as e: return f"Input Validation Error: {e}" return get_program_template(model.program_type)
- Pydantic input model defining the expected parameters and validation (program_type must be 'math' or 'debate') for the tool.class PromptProgramInput(BaseModel): program_type: str = Field( "math", pattern="^(math|debate)$", description="Program type." )
- Core helper function called by the handler to select and return the specific prompt program template (math or debate) based on the input type.def get_program_template(program_type: str) -> str: """Return a prompt program template for the requested type. Args: program_type: Identifier for the program to generate (e.g., "math", "debate"). Returns: Template string for the requested program, or a generic message with the math solver template when unsupported. """ normalized_type = program_type.lower() if normalized_type == "math": return PROMPT_PROGRAM_MATH_TEMPLATE elif normalized_type == "debate": return PROMPT_PROGRAM_DEBATE_TEMPLATE return ( f"// Program type '{program_type}' not yet implemented. Returning generic structure.\\n" + PROMPT_PROGRAM_MATH_TEMPLATE )