Skip to main content
Glama
mumez

smalltalk-validator-mcp-server

validate_tonel_smalltalk_from_file

Validate Tonel formatted Smalltalk source code by providing a file path. Optionally skip method body validation to check only Tonel structure.

Instructions

Validate Tonel formatted Smalltalk source code from a file.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
file_pathYesPath to the Tonel file to validate
optionsNoOptional validation options - without-method-body: If true, only validates tonel structure

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The core implementation function that validates Tonel Smalltalk from a file. Checks if file exists, creates a TonelTreeSitterParser (optionally ignoring method body errors), parses the file, and returns validation results with errors if any.
    def validate_tonel_smalltalk_from_file_impl(
        file_path: str, options: dict[str, Any] | None = None
    ) -> dict[str, Any]:
        """
        Validate Tonel formatted Smalltalk source code from a file.
    
        Args:
            file_path: Path to the Tonel file to validate
            options: Optional validation options
                - without-method-body: If true, only validates tonel structure
    
        Returns:
            Dictionary with validation results including success status and error details
        """
        try:
            if not os.path.exists(file_path):
                return {
                    "valid": False,
                    "error": f"File not found: {file_path}",
                    "file_path": file_path,
                }
    
            options = options or {}
            without_method_body = options.get("without-method-body", False)
    
            parser = TonelTreeSitterParser(ignore_method_body_errors=without_method_body)
            parse_result = parser.parse_from_file(file_path)
    
            result: dict[str, Any] = {
                "valid": parse_result["valid"],
                "file_path": file_path,
                "parser_type": "tonel_only" if without_method_body else "full",
            }
    
            if parse_result["errors"]:
                result["errors"] = parse_result["errors"]
    
            return result
    
        except Exception as e:
            return {
                "valid": False,
                "error": f"Validation failed: {str(e)}",
                "file_path": file_path,
                "exception": type(e).__name__,
            }
  • The handler function signature defines the input schema: file_path (str) and options (optional dict[str,Any]) as inputs; returns dict[str,Any]. Docstring documents the 'without-method-body' option.
        _: Context, file_path: str, options: dict[str, Any] | None = None
    ) -> dict[str, Any]:
        """
        Validate Tonel formatted Smalltalk source code from a file.
    
        Args:
            file_path: Path to the Tonel file to validate
            options: Optional validation options
                - without-method-body: If true, only validates tonel structure
    
        Returns:
            Dictionary with validation results including success status and error details
        """
        return validate_tonel_smalltalk_from_file_impl(file_path, options)
  • The MCP tool is registered with FastMCP using @app.tool('validate_tonel_smalltalk_from_file') decorator, binding the tool name to the handler function that delegates to the implementation.
    @app.tool("validate_tonel_smalltalk_from_file")
    def validate_tonel_smalltalk_from_file(
        _: Context, file_path: str, options: dict[str, Any] | None = None
    ) -> dict[str, Any]:
        """
        Validate Tonel formatted Smalltalk source code from a file.
    
        Args:
            file_path: Path to the Tonel file to validate
            options: Optional validation options
                - without-method-body: If true, only validates tonel structure
    
        Returns:
            Dictionary with validation results including success status and error details
        """
        return validate_tonel_smalltalk_from_file_impl(file_path, options)
  • The TonelTreeSitterParser class used by the implementation. The parse_from_file method reads the file and calls parse(), which uses tree-sitter to validate syntax and collect errors.
    class TonelTreeSitterParser:
        """Validates Tonel formatted Smalltalk source using tree-sitter.
    
        Args:
            ignore_method_body_errors: When True, errors inside method_body nodes
                are suppressed (equivalent to old TonelParser / tonel-only mode).
        """
    
        def __init__(self, ignore_method_body_errors: bool = False) -> None:
            self._ignore = ignore_method_body_errors
            self._parser = _make_parser()
    
        def parse(self, content: str) -> dict[str, Any]:
            tree = self._parser.parse(content.encode("utf-8"))
            errors = _collect_errors(tree.root_node, self._ignore)
            return {"valid": len(errors) == 0, "errors": errors}
    
        def parse_from_file(self, file_path: str) -> dict[str, Any]:
            with open(file_path, encoding="utf-8") as f:
                content = f.read()
            return self.parse(content)
Behavior2/5

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

No annotations are provided, so the description bears full responsibility. It does not disclose side effects (likely none), what happens on validation failure, or any return format beyond what the output schema might imply. The description is too brief to convey behavioral traits.

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?

The description is a single, efficient sentence that conveys the core purpose without extra words.

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?

Given the availability of an output schema, the description is minimally adequate but lacks important contextual details like expected file extensions, error handling behavior, or how validation results are returned. For a validation tool, this gap is notable.

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%, and the description largely repeats schema descriptions for both parameters. For 'options', it adds a minor example ('without-method-body'), but this is already in the schema. Baseline 3 is appropriate as no extra meaning is added.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states it validates Tonel Smalltalk source code from a file. It uses a specific verb and resource, but does not explicitly differentiate from sibling tools like validate_tonel_smalltalk or lint_tonel_smalltalk_from_file, which likely operate differently.

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 guidance is provided on when to use this tool versus its siblings. There is no mention of prerequisites, scenarios, or alternatives, leaving the agent to guess when this tool is appropriate.

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