Skip to main content
Glama
mumez

pharo-smalltalk-interop-mcp-server

eval

Evaluates a Pharo Smalltalk expression in a live image and returns the result or error.

Instructions

Evaluate a Pharo Smalltalk expression with PharoSmalltalkInteropServer.

Args: code: The Smalltalk code to evaluate

Returns: dict: API response with success/error and result - Success: {"success": True, "result": any} - result contains the evaluation result - Error: {"success": False, "error": str} - error contains error message

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
codeYesThe Smalltalk code to evaluate

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The tool 'eval' is registered via the @mcp.tool('eval') decorator on the eval_code function.
    @mcp.tool("eval")
  • The MCP tool handler function 'eval_code' that receives the 'code' parameter and delegates to interop_eval().
    def eval_code(
        _: Context,
        code: Annotated[str, Field(description="The Smalltalk code to evaluate")],
    ) -> dict[str, Any]:
        """
        Evaluate a Pharo Smalltalk expression with PharoSmalltalkInteropServer.
    
        Args:
            code: The Smalltalk code to evaluate
    
        Returns:
            dict: API response with success/error and result
            - Success: {"success": True, "result": any} - result contains the evaluation result
            - Error: {"success": False, "error": str} - error contains error message
        """
        return interop_eval(code)
  • Input schema: 'code' parameter is defined as Annotated[str, Field(description='The Smalltalk code to evaluate')].
    _: Context,
    code: Annotated[str, Field(description="The Smalltalk code to evaluate")],
  • The interop_eval() helper function in core.py that gets the PharoClient and calls client.evaluate(code).
    def interop_eval(code: str) -> dict[str, Any]:
        """
        Evaluate a Pharo Smalltalk expression with PharoSmalltalkInteropServer.
    
        Args:
            code: The Smalltalk code to evaluate
    
        Returns:
            API response with success/error and result
        """
        client = get_pharo_client()
        return client.evaluate(code)
  • The PharoClient.evaluate() method that POSTs the code to the /eval endpoint of the Pharo server.
    def evaluate(self, code: str) -> dict[str, Any]:
        """Evaluate Smalltalk expression."""
        data = {"code": code}
        return self._make_request("POST", "/eval", data)
Behavior2/5

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

No annotations are provided, so the description must fully disclose behavioral traits. It only describes the return format (success/error dict) but does not warn about potential side effects, risks of arbitrary code execution, or required permissions. This is a significant gap for an evaluation tool.

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 structured with 'Args' and 'Returns' sections, but includes redundant formatting (e.g., 'Returns:' block) that could be more concise. It is not overly long but could be streamlined.

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?

Given that this is an arbitrary code execution tool with no annotations, the description lacks crucial information about side effects, safety considerations, error behavior, and prerequisites. It mentions the return format but omits important context for safe usage.

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

Parameters3/5

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

Schema coverage is 100% with a single 'code' parameter described. The description repeats the same text as the schema's description, adding no additional meaning beyond what is already in the input schema. Baseline score of 3 is appropriate.

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 'Evaluate a Pharo Smalltalk expression' with a specific verb and resource. It distinguishes from sibling tools that perform different operations like export, import, reading, or searching.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The purpose is implied by the tool name and description, but there is no explicit guidance on when to use this tool versus alternatives or any exclusions. Sibling tools cover different domains, but no when-not advice is provided.

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/mumez/pharo-smalltalk-interop-mcp-server'

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