Skip to main content
Glama
mumez

smalltalk-validator-mcp-server

validate_smalltalk_method_body

Validate syntax correctness of a Smalltalk method body. Supply the method body content as input to detect syntax errors.

Instructions

Validate a Smalltalk method body for syntax correctness.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
method_body_contentYesThe Smalltalk method body content as a string

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • MCP tool registration with @app.tool decorator, defines the validate_smalltalk_method_body tool entry point.
    @app.tool("validate_smalltalk_method_body")
    def validate_smalltalk_method_body(
        _: Context, method_body_content: str
    ) -> dict[str, Any]:
        """
        Validate a Smalltalk method body for syntax correctness.
    
        Args:
            method_body_content: The Smalltalk method body content as a string
    
        Returns:
            Dictionary with validation results including success status and error details
        """
        return validate_smalltalk_method_body_impl(method_body_content)
  • Core handler implementation validate_smalltalk_method_body_impl that delegates to SmalltalkMethodParser.
    def validate_smalltalk_method_body_impl(method_body_content: str) -> dict[str, Any]:
        """
        Validate a Smalltalk method body for syntax correctness.
    
        Args:
            method_body_content: The Smalltalk method body content as a string
    
        Returns:
            Dictionary with validation results including success status and error details
        """
        try:
            parser = SmalltalkMethodParser()
            parse_result = parser.parse(method_body_content)
    
            result: dict[str, Any] = {
                "valid": parse_result["valid"],
                "content_length": len(method_body_content),
                "parser_type": "smalltalk_method",
            }
    
            if parse_result["errors"]:
                result["errors"] = parse_result["errors"]
    
            return result
    
        except Exception as e:
            return {
                "valid": False,
                "error": f"Method validation failed: {str(e)}",
                "content_length": len(method_body_content),
                "exception": type(e).__name__,
            }
  • SmalltalkMethodParser class that wraps method body in synthetic Tonel and parses with tree-sitter.
    class SmalltalkMethodParser:
        """Validates a standalone Smalltalk method body by wrapping it in synthetic Tonel."""
    
        def __init__(self) -> None:
            self._parser = _make_parser()
    
        def parse(self, method_body_content: str) -> dict[str, Any]:
            wrapped = _METHOD_PREFIX + method_body_content + "\n]\n"
            tree = self._parser.parse(wrapped.encode("utf-8"))
            errors = self._method_body_errors(tree.root_node)
            return {"valid": len(errors) == 0, "errors": errors}
  • Synthetic Tonel wrapper prefix used by SmalltalkMethodParser to validate standalone method bodies.
    # Synthetic Tonel wrapper for method-body-only validation.
    # 3 lines of prefix keep column numbers intact for error reporting.
    _METHOD_PREFIX = "Class { #name : #__Temp__ }\n\n__Temp__ >> __method__ [\n"
    _METHOD_PREFIX_ROWS = _METHOD_PREFIX.count("\n")  # == 3
  • Internal helper to collect ERROR/MISSING nodes under a method_body node with row offset adjustment.
    def _errors_under(self, node) -> list[dict[str, Any]]:
        errors: list[dict[str, Any]] = []
        if node.type in ("ERROR", "MISSING"):
            errors.append(_make_error_dict(node, row_offset=_METHOD_PREFIX_ROWS))
        for child in node.children:
            errors.extend(self._errors_under(child))
        return errors
Behavior2/5

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

No annotations provided, so description must carry full burden. It only states 'validate for syntax correctness' without mentioning side effects, return format, or error behavior. Minimal behavioral disclosure.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

A single sentence conveying the core purpose with no extraneous words. Efficient and to the point.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

With only one parameter and an output schema (though not shown), the description is adequate but could mention return format or error handling. Given the tool's simplicity, it's moderately complete.

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?

The schema covers 100% of parameters with a clear description for 'method_body_content'. The description adds no new information beyond the schema, meeting baseline for high coverage.

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 the verb 'Validate', the resource 'Smalltalk method body', and the scope 'for syntax correctness'. It distinguishes from siblings which deal with files or linting.

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

Usage Guidelines2/5

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

No explicit guidance on when to use this tool vs alternatives like validate_tonel_smalltalk or lint. The name implies it's for method body strings, but no when-to-use or when-not-to-use advice.

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/smalltalk-validator-mcp-server'

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