Skip to main content
Glama

get_prompt_program

Generate functional pseudo-code prompt templates for math or debate programs to structure LLM reasoning tasks.

Instructions

Returns a functional pseudo-code prompt template (Module 07).

Args:
    program_type: The type of program ('math', 'debate').

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
program_typeNomath

Implementation Reference

  • The main handler function for the 'get_prompt_program' tool. Decorated with @mcp.tool() for automatic registration. Validates input using PromptProgramInput schema and delegates to get_program_template helper.
    @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 used for validating the program_type parameter in the get_prompt_program tool.
    class PromptProgramInput(BaseModel):
        program_type: str = Field(
            "math", pattern="^(math|debate)$", description="Program type."
        )
  • Helper function that selects and returns the appropriate prompt program template (math or debate) based on the program_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
        )

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/4rgon4ut/sutra'

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