Skip to main content
Glama

symbolic_abstract

Convert concrete expressions into abstract variables for mathematical reasoning, simplification, or proof generation by mapping tokens to symbols and creating structured prompts.

Instructions

Convert a concrete expression into abstract variables for reasoning.

    Args:
        expression: The raw text or equation to abstract.
        mapping_hint: Optional guidance for token-to-symbol mapping.
        goal: Optional downstream task (e.g., simplify, prove, generalize).

    Returns:
        Structured prompt that maps tokens to symbols, restates the problem
        abstractly, and provides a reversible mapping table.
    

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
expressionYes
mapping_hintNo
goalNo

Implementation Reference

  • The core handler function for the 'symbolic_abstract' tool, decorated with @mcp.tool(). It validates input using SymbolicAbstractInput schema and generates a structured JSON-like prompt template for abstracting expressions into symbols.
        @mcp.tool()
        def symbolic_abstract(
            expression: str,
            mapping_hint: Optional[str] = None,
            goal: Optional[str] = None,
        ) -> str:
            """Convert a concrete expression into abstract variables for reasoning.
    
            Args:
                expression: The raw text or equation to abstract.
                mapping_hint: Optional guidance for token-to-symbol mapping.
                goal: Optional downstream task (e.g., simplify, prove, generalize).
    
            Returns:
                Structured prompt that maps tokens to symbols, restates the problem
                abstractly, and provides a reversible mapping table.
            """
            try:
                model = SymbolicAbstractInput(
                    expression=expression, mapping_hint=mapping_hint, goal=goal
                )
            except ValidationError as e:
                return f"Input Validation Error: {e}"
    
            normalized_hint = model.mapping_hint or "<none>"
            normalized_goal = model.goal or "<general>"
    
            template = """
    /symbolic.abstract{{
        intent="Abstract concrete tokens into symbolic variables to enable general reasoning",
        input={{
            expression="{expression}",
            mapping_hint="{mapping_hint}",
            goal="{goal}"
        }},
        process=[
            /tokenize{{action="Identify meaningful tokens/entities in the expression"}},
            /assign_symbols{{action="Map tokens to abstract symbols with reversible table"}},
            /restatement{{action="Restate the problem using only symbols"}},
            /constraints{{action="Preserve constraints or relationships between symbols"}}
        ],
        output={{
            abstract_form="Symbolic restatement of the expression/problem",
            symbol_table="Mapping of symbols -> original tokens",
            invariants="Constraints/relations maintained in abstraction",
            next_steps="How to use the abstraction for the stated goal"
        }}
    }}
    """
            return template.format(
                expression=model.expression,
                mapping_hint=normalized_hint,
                goal=normalized_goal,
            )
  • Pydantic input model (schema) used for validating parameters of the symbolic_abstract tool: required 'expression' and optional 'mapping_hint', 'goal'.
    class SymbolicAbstractInput(BaseModel):
        expression: str = Field(
            ..., min_length=1, description="The raw text or equation to abstract."
        )
        mapping_hint: Optional[str] = Field(
            None, description="Optional guidance for token-to-symbol mapping."
        )
        goal: Optional[str] = Field(None, description="Optional downstream task.")
  • Invocation of register_thinking_models on the FastMCP server instance, which defines and registers the symbolic_abstract tool (along with other cognitive tools).
    register_thinking_models(mcp)

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