### Install pharo-smalltalk-interop-mcp-server using uvx Source: https://github.com/mumez/pharo-smalltalk-interop-mcp-server/blob/main/README.md This command installs the pharo-smalltalk-interop-mcp-server package globally using the uvx package manager, allowing for quick execution without cloning the repository. It is the recommended method for a quick start. ```bash uvx --from git+https://github.com/mumez/pharo-smalltalk-interop-mcp-server.git pharo-smalltalk-interop-mcp-server ``` -------------------------------- ### Read Screen Tool Usage Examples (Python) Source: https://github.com/mumez/pharo-smalltalk-interop-mcp-server/blob/main/CLAUDE.md Demonstrates how to use the `read_screen` tool to capture UI information from Pharo interfaces. It shows examples for inspecting 'world' morphs, 'spec' windows, and 'roassal' visualizations, with options to include or exclude screenshots. ```python # Capture world morphs with screenshot result = read_screen(target_type="world", capture_screenshot=True) # Inspect Spec windows without screenshot result = read_screen(target_type="spec", capture_screenshot=False) # Inspect Roassal visualizations result = read_screen(target_type="roassal", capture_screenshot=True) ``` -------------------------------- ### Install Development Dependencies with uv Source: https://github.com/mumez/pharo-smalltalk-interop-mcp-server/blob/main/README.md After cloning the repository, navigate into the project directory and use this command to install all development dependencies specified in the project's configuration files using the uv package manager. ```bash cd pharo-smalltalk-interop-mcp-server uv sync --dev ``` -------------------------------- ### MCP Server Configuration Example (JSON) Source: https://github.com/mumez/pharo-smalltalk-interop-mcp-server/blob/main/CLAUDE.md An example JSON configuration for setting up the Pharo Smalltalk Interop MCP server within Cursor's mcp.json file. It specifies the command to run, arguments, and optional environment variables. ```json { "mcpServers": { "pharo-smalltalk-interop-mcp-server": { "command": "uv", "args": [ "--directory", "/path/to/pharo-smalltalk-interop-mcp-server", "run", "pharo-smalltalk-interop-mcp-server" ], "env": { "PHARO_SIS_PORT": "8081" } } } } ``` -------------------------------- ### Run pharo-smalltalk-interop-mcp-server with custom port using uv Source: https://github.com/mumez/pharo-smalltalk-interop-mcp-server/blob/main/README.md This example shows how to execute the pharo-smalltalk-interop-mcp-server from a local installation using uv run, while specifying a custom port (9999) for the PharoSmalltalkInteropServer via the PHARO_SIS_PORT environment variable. ```bash PHARO_SIS_PORT=9999 uv run pharo-smalltalk-interop-mcp-server ``` -------------------------------- ### Run pharo-smalltalk-interop-mcp-server using uv Source: https://github.com/mumez/pharo-smalltalk-interop-mcp-server/blob/main/README.md After cloning the repository and installing dependencies, this command runs the pharo-smalltalk-interop-mcp-server from the local project directory using the uv run command. ```bash uv run pharo-smalltalk-interop-mcp-server ``` -------------------------------- ### MCP Server Configuration using uv Source: https://github.com/mumez/pharo-smalltalk-interop-mcp-server/blob/main/README.md This JSON configuration outlines the setup for the 'smalltalk-interop' MCP server when using uv after cloning the repository. It includes the command, arguments pointing to the local directory and the run command, and optional environment variables. ```json { "mcpServers": { "smalltalk-interop": { "command": "uv", "args": [ "--directory", "/your-path/to/pharo-smalltalk-interop-mcp-server", "run", "pharo-smalltalk-interop-mcp-server" ], "env": { "PHARO_SIS_PORT": "8086" } } } } ``` -------------------------------- ### Install Project with Metacello using Python Source: https://context7.com/mumez/pharo-smalltalk-interop-mcp-server/llms.txt Installs a Pharo project using Metacello, Pharo's package management system, supporting various repository types like GitHub and file systems. Depends on the pharo_smalltalk_interop_mcp_server.core module and requires a functional Pharo environment. Inputs are project name, repository URL, and optional load groups; outputs include success confirmation or error; limitations are network availability for remote repos and compatibility with Metacello configurations. ```python from pharo_smalltalk_interop_mcp_server.core import interop_install_project # Install project from GitHub result = interop_install_project( project_name="Roassal3", repository_url="github://ObjectProfile/Roassal3/src" ) # Returns: { # "success": True, # "result": "Project Roassal3 installed successfully" # } # Install with specific load groups result = interop_install_project( project_name="Seaside", repository_url="github://SeasideSt/Seaside/repository", load_groups="Core,Tests" ) # Returns: { # "success": True, # "result": "Project Seaside installed with groups: Core,Tests" # } # Install from different repository types result = interop_install_project( project_name="MyProject", repository_url="filetree:///home/user/projects/MyProject/src" ) ``` -------------------------------- ### Run pharo-smalltalk-interop-mcp-server with custom port using uvx Source: https://github.com/mumez/pharo-smalltalk-interop-mcp-server/blob/main/README.md This example demonstrates how to run the pharo-smalltalk-interop-mcp-server using uvx while setting a custom port (8086) for the PharoSmalltalkInteropServer via the PHARO_SIS_PORT environment variable. ```bash PHARO_SIS_PORT=8086 uvx --from git+https://github.com/mumez/pharo-smalltalk-interop-mcp-server.git pharo-smalltalk-interop-mcp-server ``` -------------------------------- ### Read Screen Tool Output - JSON Source: https://github.com/mumez/pharo-smalltalk-interop-mcp-server/blob/main/README.md JSON output examples showing the data structure returned by the read_screen tool for different target types including World (morphs with bounds and properties), Spec (presenters with window details), and Roassal (visualizations with shapes and edges). ```json { "totalMorphs": 12, "displayedMorphCount": 1, "morphs": [ { "class": "MenubarMorph", "visible": true, "bounds": {"x": 0, "y": 0, "width": 976, "height": 18}, "backgroundColor": "(Color r: 0.883... alpha: 0.8)", "owner": "WorldMorph", "submorphCount": 8 } ] } ``` ```json { "windowCount": 1, "presenters": [ { "class": "SpWindowPresenter", "title": "Welcome", "extent": "(700@550)", "hasMenu": false, "presenter": { "class": "StWelcomeBrowser", "childCount": 2, "isVisible": true, "children": [] } } ] } ``` ```json { "canvasCount": 1, "canvases": [ { "class": "RSAthensMorph", "canvasClass": "RSCanvas", "bounds": {"x": 203, "y": 145, "width": 490, "height": 467}, "backgroundColor": "Color blue", "zoomLevel": "1.0", "shapeCount": 5, "shapes": [ { "class": "RSCircle", "color": "(Color r: 1.0 g: 0.0 b: 0.0 alpha: 0.2)", "position": "(0.0@0.0)", "extent": "(5.0@5.0)" } ], "edgeCount": 0, "edges": [], "nodeCount": 0 } ] } ``` -------------------------------- ### Read Screen Tool Usage - Python Source: https://github.com/mumez/pharo-smalltalk-interop-mcp-server/blob/main/README.md Examples of using the read_screen tool for different target types in the Pharo UI debugging system. Shows how to inspect morphs, Spec presenters, and Roassal visualizations with various configuration options. ```python # Inspect all morphs in World read_screen(target_type='world') # Inspect Spec presenter windows read_screen(target_type='spec', capture_screenshot=false) # Inspect Roassal visualizations without screenshot (faster) read_screen(target_type='roassal', capture_screenshot=false) ``` -------------------------------- ### Singleton Client Usage - Python Library Source: https://context7.com/mumez/pharo-smalltalk-interop-mcp-server/llms.txt Shows how to use the global singleton client instance for connection reuse in the Pharo Smalltalk Interop library. Demonstrates getting the singleton instance and using the interop_eval convenience function for evaluating Smalltalk code. ```Python from pharo_smalltalk_interop_mcp_server.core import get_pharo_client # Get or create global client instance client = get_pharo_client() # Multiple calls return the same instance (connection reuse) client1 = get_pharo_client() client2 = get_pharo_client() assert client1 is client2 # True # All interop_* functions use the singleton automatically from pharo_smalltalk_interop_mcp_server.core import interop_eval result = interop_eval("Time now") ``` -------------------------------- ### Retrieve Smalltalk Class Comments in Python Source: https://context7.com/mumez/pharo-smalltalk-interop-mcp-server/llms.txt Gets the documentation comment for a Smalltalk class using interop_get_class_comment. Input is the class name; output is JSON with success/result containing the comment text. Suitable for built-in and custom classes; errors not explicitly handled in examples. ```python from pharo_smalltalk_interop_mcp_server.core import interop_get_class_comment # Get Object class comment result = interop_get_class_comment("Object") # Returns: { # "success": True, # "result": "Object is the root class of almost all Smalltalk class hierarchies..." # } # Get comment for custom class result = interop_get_class_comment("TestCase") # Returns detailed documentation about the TestCase class ``` -------------------------------- ### MCP Server Configuration using uvx Source: https://github.com/mumez/pharo-smalltalk-interop-mcp-server/blob/main/README.md This JSON configuration defines how to set up the 'smalltalk-interop' MCP server using uvx. It specifies the command, arguments to fetch and run the server from a Git repository, and environment variables like the port number. ```json { "mcpServers": { "smalltalk-interop": { "command": "uvx", "args": [ "--from", "git+https://github.com/mumez/pharo-smalltalk-interop-mcp-server.git", "pharo-smalltalk-interop-mcp-server" ], "env": { "PHARO_SIS_PORT": "8086" } } } } ``` -------------------------------- ### Clone pharo-smalltalk-interop-mcp-server Repository Source: https://github.com/mumez/pharo-smalltalk-interop-mcp-server/blob/main/README.md This command clones the pharo-smalltalk-interop-mcp-server repository from GitHub to your local machine. This is the first step for setting up the project for development. ```bash git clone https://github.com/mumez/pharo-smalltalk-interop-mcp-server.git ``` -------------------------------- ### Add MCP Server using uv with Claude Source: https://github.com/mumez/pharo-smalltalk-interop-mcp-server/blob/main/README.md This command adds the pharo-smalltalk-interop-mcp-server to Claude's MCP configuration, using uv for execution from a local path. It specifies the server name as 'smalltalk-interop' and requires the path to the cloned repository. ```bash claude mcp add -s user smalltalk-interop -- uv --directory /path/to/pharo-smalltalk-interop-mcp-server run pharo-smalltalk-interop-mcp-server ``` -------------------------------- ### List All Packages - Python Source: https://context7.com/mumez/pharo-smalltalk-interop-mcp-server/llms.txt This function fetches a list of all packages in the Pharo Smalltalk image. It requires the core module and has no inputs, outputting a dictionary with success and a list of package names. The result is based on the current image state and may not include runtime-loaded packages. ```python from pharo_smalltalk_interop_mcp_server.core import interop_list_packages # Get all packages result = interop_list_packages() # Returns: { # "success": True, # "result": [ # "Kernel", # "Collections-Abstract", # "Collections-Strings", # "Network-HTTP", # "MyCustomPackage", # ... # ] # } ``` -------------------------------- ### Test Execution Commands - Bash Source: https://github.com/mumez/pharo-smalltalk-interop-mcp-server/blob/main/README.md Shell commands for running tests in the Pharo Smalltalk interop MCP server project using pytest. Includes commands for running all tests, verbose output, and specific test files. ```bash # Run all tests uv run pytest # Run tests with verbose output uv run pytest -v # Run specific test file uv run pytest tests/test_core.py -v ``` -------------------------------- ### Add MCP Server using uvx with Claude Source: https://github.com/mumez/pharo-smalltalk-interop-mcp-server/blob/main/README.md This command uses the 'claude mcp add' command to register the pharo-smalltalk-interop-mcp-server as an MCP server named 'smalltalk-interop'. It utilizes uvx for execution, making it a convenient way to add the server for use with Claude. ```bash claude mcp add -s user smalltalk-interop -- uvx --from git+https://github.com/mumez/pharo-smalltalk-interop-mcp-server.git pharo-smalltalk-interop-mcp-server ``` -------------------------------- ### Import Package from Tonel Format using Python Source: https://context7.com/mumez/pharo-smalltalk-interop-mcp-server/llms.txt This function imports a Pharo package from Tonel format files into the active Pharo image, allowing seamless integration of external code. It requires the pharo_smalltalk_interop_mcp_server.core module and assumes a running Pharo session. Inputs include package name and directory path; outputs are a success dictionary or error details; limitations include dependency on existing Tonel directories and potential failures for invalid paths or non-existent packages. ```python from pharo_smalltalk_interop_mcp_server.core import interop_import_package # Import from default location result = interop_import_package("MyPackage", "/tmp") # Returns: { # "success": True, # "result": "Package MyPackage imported successfully" # } # Import from custom location result = interop_import_package("MyPackage", "/home/user/projects/pharo-src") # Error handling for missing package result = interop_import_package("NonExistentPackage", "/tmp") # Returns: {"success": False, "error": "Package not found at path"} ``` -------------------------------- ### Search Smalltalk Methods by Pattern in Python Source: https://context7.com/mumez/pharo-smalltalk-interop-mcp-server/llms.txt Finds methods matching a pattern across the system using interop_search_methods_like. Inputs are pattern strings like 'add*'; outputs JSON with success/array of method selectors. Useful for discovering setters or common operations; wildcards supported. ```python from pharo_smalltalk_interop_mcp_server.core import interop_search_methods_like # Find methods starting with "add" result = interop_search_methods_like("add*") # Returns: {"success": True, "result": ["add:", "addAll:", "addFirst:", ...]} # Find setters result = interop_search_methods_like("set*:") ``` -------------------------------- ### UI Debugging - read_screen Source: https://github.com/mumez/pharo-smalltalk-interop-mcp-server/blob/main/CLAUDE.md The `read_screen` tool allows for comprehensive UI inspection of Pharo interfaces. It can capture screenshots and extract the complete UI structure. Supported UI types include 'world', 'spec', and 'roassal'. ```APIDOC ## GET /read_screen ### Description Retrieves UI inspection data for Pharo interfaces, optionally including a screenshot. ### Method GET ### Endpoint /read_screen ### Parameters #### Query Parameters - **target_type** (string) - Optional - The type of UI to inspect. Supported values: 'world' (default), 'spec', 'roassal'. - **capture_screenshot** (boolean) - Optional - Whether to include a PNG screenshot in the response. Defaults to `true`. ### Response #### Success Response (200) - **success** (boolean) - Indicates if the operation was successful. - **result** (object) - Contains the inspection results. - **screenshot** (string) - Path to the captured screenshot (if requested). - **target_type** (string) - The type of UI that was inspected. - **structure** (object) - Detailed structure of the UI elements. - **summary** (string) - A brief summary of the UI structure. #### Response Example ```json { "success": true, "result": { "screenshot": "/tmp/pharo_screenshot_20250105_123456.png", "target_type": "world", "structure": { "morphs": [], "count": 42, "details": "..." }, "summary": "World contains 42 morphs including..." } } ``` ### Usage Example (Python) ```python # Capture world morphs with screenshot result = read_screen(target_type="world", capture_screenshot=True) # Inspect Spec windows without screenshot result = read_screen(target_type="spec", capture_screenshot=False) # Inspect Roassal visualizations result = read_screen(target_type="roassal", capture_screenshot=True) ``` ``` -------------------------------- ### POST /run_package_test Source: https://github.com/mumez/pharo-smalltalk-interop-mcp-server/blob/main/README.md Run test suites for a package in Pharo Smalltalk. This endpoint executes comprehensive test suites for specified packages. ```APIDOC ## POST /run_package_test ### Description Run test suites for a package in Pharo Smalltalk. This endpoint executes comprehensive test suites for specified packages. ### Method POST ### Endpoint /run_package_test ### Parameters #### Request Body - **package_name** (string) - Required - Name of the package to test ### Request Example { "package_name": "MyPackage" } ### Response #### Success Response (200) - **result** (string) - Test execution result - **passed** (integer) - Number of passed tests - **failed** (integer) - Number of failed tests - **errors** (integer) - Number of errors #### Response Example { "result": "success", "passed": 15, "failed": 0, "errors": 0 } ``` -------------------------------- ### Search Methods by Pattern - Python Source: https://context7.com/mumez/pharo-smalltalk-interop-mcp-server/llms.txt This function searches for method selectors matching a given pattern in Pharo Smalltalk. It depends on the pharo_smalltalk_interop_mcp_server module and takes a string pattern as input, returning a dictionary with success status and a list of matching selectors. Limitations include relying on the Smalltalk image's current state and potential performance issues with broad patterns. ```python from pharo_smalltalk_interop_mcp_server.core import interop_search_methods_like # Find binary operators result = interop_search_methods_like("+") # Returns: {"success": True, "result": ["+"]} ``` ```python # Find methods starting with 'set' result = interop_search_methods_like("set*") # Returns: {"success": True, "result": ["setName:", "setValue:", "setColor:", ...]} ``` -------------------------------- ### Run Package Tests using Python Source: https://context7.com/mumez/pharo-smalltalk-interop-mcp-server/llms.txt Executes all test cases within a specified Pharo package and returns a summary of results, including pass/fail counts. It relies on pharo_smalltalk_interop_mcp_server.core and a running Pharo image with tests defined. Inputs are the package name; outputs provide test statistics or failure details; limitations include handling large test suites and dependencies on Pharo's test framework. ```python from pharo_smalltalk_interop_mcp_server.core import interop_run_package_test # Run tests for a package result = interop_run_package_test("Kernel-Tests") # Returns: { # "success": True, # "result": "127 run, 127 passes, 0 failures, 0 errors in 1.234s" # } # Run tests for custom package result = interop_run_package_test("MyPackage-Tests") # Returns: { # "success": True, # "result": "45 run, 43 passes, 2 failures, 0 errors in 0.567s" # } # Handle package with failing tests result = interop_run_package_test("BrokenPackage-Tests") # Returns: { # "success": False, # "error": { # "description": "Test failures detected", # "failures": ["TestClass>>testMethod1", "TestClass>>testMethod2"] # } # } ``` -------------------------------- ### Read Screen World Morphs using Python Source: https://context7.com/mumez/pharo-smalltalk-interop-mcp-server/llms.txt Captures UI structure and optional screenshots of Pharo's World morphs for debugging interfaces, including Spec and Roassal elements. Depends on pharo_smalltalk_interop_mcp_server.core and a graphical Pharo session. Inputs specify target type and screenshot option; outputs include morph details and image path; limitations are related to active UI and performance with screenshots. ```python from pharo_smalltalk_interop_mcp_server.core import interop_read_screen # Inspect World morphs with screenshot result = interop_read_screen(target_type="world", capture_screenshot=True) # Returns: { # "success": True, # "result": { # "screenshot": "/tmp/pharo_screenshot_20250109_153045.png", # "target_type": "world", # "structure": { # "totalMorphs": 12, # "displayedMorphCount": 1, # "morphs": [ # { # "class": "MenubarMorph", # "visible": True, # "bounds": {"x": 0, "y": 0, "width": 976, "height": 18}, # "backgroundColor": "(Color r: 0.883... alpha: 0.8)", # "owner": "WorldMorph", # "submorphCount": 8 # }, # { # "class": "TaskbarMorph", # "visible": True, # "bounds": {"x": 0, "y": 982, "width": 976, "height": 18}, # "submorphCount": 3 # } # ] # }, # "summary": "World contains 12 morphs including MenubarMorph, TaskbarMorph" # } # } # Inspect without screenshot (faster) result = interop_read_screen(target_type="world", capture_screenshot=False) ``` -------------------------------- ### Run Class Tests using Python Source: https://context7.com/mumez/pharo-smalltalk-interop-mcp-server/llms.txt Runs all test methods in a specific Pharo test class and summarizes the execution results. Requires pharo_smalltalk_interop_mcp_server.core and assumes the class is a subclass of TestCase. Inputs include the class name; outputs are test summaries or errors if not a valid test class; limitations apply to non-test classes and require Pharo's testing infrastructure. ```python from pharo_smalltalk_interop_mcp_server.core import interop_run_class_test # Run tests for specific class result = interop_run_class_test("StringTest") # Returns: { # "success": True, # "result": "89 run, 89 passes, 0 failures, 0 errors in 0.234s" # } # Run custom test class result = interop_run_class_test("MyClassTest") # Returns: { # "success": True, # "result": "12 run, 10 passes, 2 failures, 0 errors in 0.123s" # } # Error handling for non-test class result = interop_run_class_test("Object") # Returns: {"success": False, "error": "Object is not a TestCase subclass"} ``` -------------------------------- ### POST /read_screen Source: https://github.com/mumez/pharo-smalltalk-interop-mcp-server/blob/main/README.md UI screen reader for debugging Pharo interfaces with screenshot and structure extraction. Captures screenshots and extracts UI structure for debugging Pharo UI issues. ```APIDOC ## POST /read_screen ### Description UI screen reader for debugging Pharo interfaces with screenshot and structure extraction. Captures screenshots and extracts UI structure for debugging Pharo UI issues. ### Method POST ### Endpoint /read_screen ### Parameters #### Request Body - **target_type** (string) - Optional - UI type to inspect ('world' for morphs, 'spec' for windows, 'roassal' for visualizations). Default: 'world' - **capture_screenshot** (boolean) - Optional - Include PNG screenshot in response. Default: true ### Request Example { "target_type": "world", "capture_screenshot": true } ### Response #### Success Response (200) For World (morphs): - **totalMorphs** (integer) - Total number of morphs - **displayedMorphCount** (integer) - Number of displayed morphs - **morphs** (array) - Array of morph objects - **class** (string) - Class name - **visible** (boolean) - Visibility state - **bounds** (object) - Bounds coordinates - **backgroundColor** (string) - Background color - **owner** (string) - Owner class - **submorphCount** (integer) - Submorph count For Spec (presenters): - **windowCount** (integer) - Number of windows - **presenters** (array) - Array of presenter objects - **class** (string) - Presenter class name - **title** (string) - Window title - **extent** (string) - Geometry extent - **hasMenu** (boolean) - Menu presence - **presenter** (object) - Presenter details For Roassal (visualizations): - **canvasCount** (integer) - Number of canvases - **canvases** (array) - Array of canvas objects - **class** (string) - Canvas class - **canvasClass** (string) - Canvas class identification - **bounds** (object) - Canvas bounds - **backgroundColor** (string) - Background color - **zoomLevel** (string) - Zoom level - **shapeCount** (integer) - Shape count - **shapes** (array) - Array of shape objects - **edgeCount** (integer) - Edge count #### Response Example { "totalMorphs": 12, "displayedMorphCount": 1, "morphs": [ { "class": "MenubarMorph", "visible": true, "bounds": {"x": 0, "y": 0, "width": 976, "height": 18}, "backgroundColor": "(Color r: 0.883... alpha: 0.8)", "owner": "WorldMorph", "submorphCount": 8 } ] } ``` -------------------------------- ### Error Handling - Pharo Smalltalk Interop Source: https://context7.com/mumez/pharo-smalltalk-interop-mcp-server/llms.txt Demonstrates comprehensive error handling patterns for the Pharo Smalltalk Interop client, including connection errors, HTTP errors, JSON decode errors, and timeout handling. Shows both legacy simple error format and enhanced v2.0.0+ error format with detailed stack traces and receiver information. ```Python # Connection error handling result = client.evaluate("1 + 1") if not result["success"]: error = result["error"] if isinstance(error, dict): # Enhanced error format (PharoSmalltalkInteropServer v2.0.0+) print(f"Error: {error['description']}") print(f"Stack trace:\n{error['stack_trace']}") print(f"Receiver: {error['receiver']}") else: # Simple error format (legacy) print(f"Error: {error}") else: print(f"Result: {result['result']}") # HTTP error handling result = client.get_class_source("NonExistentClass") # Returns: {"success": False, "error": "Class not found: NonExistentClass"} # JSON decode error handling (malformed response) # Returns: {"success": False, "error": "Invalid JSON response: ..."} # Request timeout handling (connection issues) # Returns: {"success": False, "error": "Connection error: ..."} ``` -------------------------------- ### Code Quality Commands - Bash Source: https://github.com/mumez/pharo-smalltalk-interop-mcp-server/blob/main/README.md Shell commands for maintaining code quality in the Pharo Smalltalk interop MCP server project using ruff for linting, formatting, and pre-commit hooks. ```bash # Run linting uv run ruff check # Run formatting uv run ruff format # Run all pre-commit hooks uv run pre-commit run --all-files ``` -------------------------------- ### List Methods in Package - Python Source: https://context7.com/mumez/pharo-smalltalk-interop-mcp-server/llms.txt This function lists all methods in a package, including extensions, in Pharo Smalltalk. It takes a package name and returns a dictionary with success and method strings. The function includes extension methods and depends on the package's definitions in the image. ```python from pharo_smalltalk_interop_mcp_server.core import interop_list_methods # Get all methods in package result = interop_list_methods("MyPackage") # Returns: { # "success": True, # "result": [ # "MyClass>>#initialize", # "MyClass>>#processData:", # "String>>#myCustomMethod", # Extension method # ... # ] # } ``` -------------------------------- ### POST /run_class_test Source: https://github.com/mumez/pharo-smalltalk-interop-mcp-server/blob/main/README.md Run test suites for a specific class in Pharo Smalltalk. This endpoint executes test suites for a specified class. ```APIDOC ## POST /run_class_test ### Description Run test suites for a specific class in Pharo Smalltalk. This endpoint executes test suites for a specified class. ### Method POST ### Endpoint /run_class_test ### Parameters #### Request Body - **class_name** (string) - Required - Name of the class to test ### Request Example { "class_name": "MyClass" } ### Response #### Success Response (200) - **result** (string) - Test execution result - **passed** (integer) - Number of passed tests - **failed** (integer) - Number of failed tests - **errors** (integer) - Number of errors #### Response Example { "result": "success", "passed": 8, "failed": 0, "errors": 0 } ``` -------------------------------- ### Search Smalltalk Classes by Pattern in Python Source: https://context7.com/mumez/pharo-smalltalk-interop-mcp-server/llms.txt Searches for classes matching a pattern with wildcards using interop_search_classes_like. Inputs are pattern strings like 'String*'; outputs JSON with success/array of matching class names. Supports case-sensitive searches across the system. ```python from pharo_smalltalk_interop_mcp_server.core import interop_search_classes_like # Find all classes starting with "String" result = interop_search_classes_like("String*") # Returns: { # "success": True, # "result": ["String", "StringMorph", "StringSignal", "StringTest"] # } # Find classes containing "Collection" result = interop_search_classes_like("*Collection*") # Returns: {"success": True, "result": ["Collection", "OrderedCollection", ...]} # Case-sensitive search result = interop_search_classes_like("Test*") # Returns all test classes: ["TestCase", "TestResult", "TestRunner", ...] ``` -------------------------------- ### Read Spec Presenters - Python Source: https://context7.com/mumez/pharo-smalltalk-interop-mcp-server/llms.txt Inspects Spec presenter windows and captures a screenshot. It returns a JSON object containing details about the window structure, including class, title, and child presenters. This function helps in understanding the UI hierarchy of Spec applications. ```python # Inspect Spec windows result = interop_read_screen(target_type="spec", capture_screenshot=True) # Returns: { # "success": True, # "result": { # "screenshot": "/tmp/pharo_screenshot_20250109_153046.png", # "target_type": "spec", # "structure": { # "windowCount": 2, # "presenters": [ # { # "class": "SpWindowPresenter", # "title": "Welcome", # "extent": "(700@550)", # "position": "(100@100)", # "hasMenu": False, # "hasToolbar": False, # "hasStatusBar": False, # "isResizable": True, # "isMaximized": False, # "isMinimized": False, # "presenter": { # "class": "StWelcomeBrowser", # "childCount": 2, # "isVisible": True, # "isEnabled": True, # "children": [ # { # "class": "SpMillerColumnPresenter", # "childCount": 7, # "isVisible": True, # "children": [] # }, # { # "class": "SpPaginatorPresenter", # "childCount": 0, # "isVisible": True, # "children": [] # } # ] # } # } # ] # }, # "summary": "2 Spec presenter(s)" # } # } ``` -------------------------------- ### Configure Pharo Interop Server Port - Python Source: https://context7.com/mumez/pharo-smalltalk-interop-mcp-server/llms.txt Configures the client to connect to the Pharo Smalltalk Interop Server on a custom port. It demonstrates using environment variables and direct constructor parameters to set the host and port, allowing flexibility in network configuration. ```python import os from pharo_smalltalk_interop_mcp_server.core import PharoClient # Using environment variable os.environ["PHARO_SIS_PORT"] = "8081" client = PharoClient() # Connects to http://localhost:8081 # Using constructor parameter (overrides environment) client = PharoClient(host="localhost", port=9999) # Connects to http://localhost:9999 # Using constructor with custom host client = PharoClient(host="192.168.1.100", port=8086) # Connects to http://192.168.1.100:8086 ``` -------------------------------- ### Export Package to Tonel Format - Python Source: https://context7.com/mumez/pharo-smalltalk-interop-mcp-server/llms.txt This function exports a package to Tonel format for version control in Pharo Smalltalk. It takes a package name and optional path, writing to disk and returning a success message. It depends on file system access and may fail if the package or path is invalid. ```python from pharo_smalltalk_interop_mcp_server.core import interop_export_package # Export to default location (/tmp) result = interop_export_package("MyPackage") # Returns: { # "success": True, # "result": "Package exported to /tmp/MyPackage" # } # Export to custom location result = interop_export_package("MyPackage", "/home/user/projects/pharo-src") ``` -------------------------------- ### Execute Smalltalk Expressions in Python Source: https://context7.com/mumez/pharo-smalltalk-interop-mcp-server/llms.txt Evaluates arbitrary Smalltalk code via PharoClient, returning results as JSON strings or error details with stack traces. Requires PharoClient initialization connecting to localhost:8086; inputs are Smalltalk expressions, outputs success/result or error objects. Limitations include local Pharo image dependency and basic error formatting. ```python from pharo_smalltalk_interop_mcp_server.core import PharoClient # Initialize client (connects to localhost:8086 by default) client = PharoClient() # Simple arithmetic result = client.evaluate("3 + 4") # Returns: {"success": True, "result": "7"} # String manipulation result = client.evaluate("'Hello, Pharo!' asUppercase") # Returns: {"success": True, "result": "'HELLO, PHARO!'"} # Collection operations result = client.evaluate("#(1 2 3 4 5) sum") # Returns: {"success": True, "result": "15"} # Error handling - enhanced error format result = client.evaluate("1 / 0") # Returns: { # "success": False, # "error": { # "description": "ZeroDivide: division by zero", # "stack_trace": "SmallInteger>>/ (SmallInteger.class:123)\n...", # "receiver": { # "class": "SmallInteger", # "self": "1", # "variables": {"value": 1} # } # } # } # Close connection when done client.close() ``` -------------------------------- ### Search Traits by Pattern - Python Source: https://context7.com/mumez/pharo-smalltalk-interop-mcp-server/llms.txt This function retrieves traits from Pharo Smalltalk that match a specified pattern. It requires the pharo_smalltalk_interop_mcp_server module and accepts a pattern string, outputting a dictionary containing success and a list of matching trait names. The functionality is limited to traits available in the current image and may not support complex regex patterns. ```python from pharo_smalltalk_interop_mcp_server.core import interop_search_traits_like # Find all traits starting with "T" result = interop_search_traits_like("T*") # Returns: {"success": True, "result": ["TComparable", "TEmpty", "TIterable"]} # Find specific trait patterns result = interop_search_traits_like("*Comparable*") # Returns traits related to comparison functionality ``` -------------------------------- ### Find Method References - Python Source: https://context7.com/mumez/pharo-smalltalk-interop-mcp-server/llms.txt This function identifies methods that reference a specific selector or symbol in Pharo Smalltalk. It uses the core module and inputs a reference string, producing a dictionary with success and a list of referencing methods. The operation relies on the image's code and may not cover dynamically compiled code. ```python from pharo_smalltalk_interop_mcp_server.core import interop_search_references # Find all methods calling "hash" result = interop_search_references("hash") # Returns: { # "success": True, # "result": [ # {"class": "Set", "method": "add:", "package": "Collections-Unordered"}, # {"class": "Dictionary", "method": "at:put:", "package": "Collections-Dictionaries"} # ] # } # Find references to a symbol result = interop_search_references("#performTest") ``` -------------------------------- ### Retrieve Smalltalk Class Source Code in Python Source: https://context7.com/mumez/pharo-smalltalk-interop-mcp-server/llms.txt Fetches the complete source code definition of a Smalltalk class using interop_get_class_source. Inputs are class names as strings; outputs JSON with success/source or error for non-existent classes. Depends on the interop module; no direct connection management needed. ```python from pharo_smalltalk_interop_mcp_server.core import interop_get_class_source # Get source for Object class result = interop_get_class_source("Object") # Returns: { # "success": True, # "result": "Object subclass: ...\n\tinstanceVariableNames: ''\n\t..." # } # Get source for custom class result = interop_get_class_source("MyCustomClass") # Handle non-existent class result = interop_get_class_source("NonExistentClass") # Returns: {"success": False, "error": "Class not found: NonExistentClass"} ``` -------------------------------- ### Pharo Interop Client Error Handling - Python Source: https://context7.com/mumez/pharo-smalltalk-interop-mcp-server/llms.txt Demonstrates error handling mechanisms provided by the PharoClient. It highlights the availability of both simple and enhanced error formats for managing exceptions during interop operations. This is crucial for robust application development. ```python from pharo_smalltalk_interop_mcp_server.core import PharoClient client = PharoClient() ``` -------------------------------- ### Find Method Implementors - Python Source: https://context7.com/mumez/pharo-smalltalk-interop-mcp-server/llms.txt This function finds all classes implementing a specific method selector in Pharo Smalltalk. It imports from the core module and takes a selector string, returning a dictionary with success and detailed results including class, method, and package. It depends on the image's method dictionary and may be slow for widely implemented methods. ```python from pharo_smalltalk_interop_mcp_server.core import interop_search_implementors # Find all classes implementing "hash" result = interop_search_implementors("hash") # Returns: { # "success": True, # "result": [ # {"class": "Object", "method": "hash", "package": "Kernel"}, # {"class": "SmallInteger", "method": "hash", "package": "Kernel"}, # {"class": "String", "method": "hash", "package": "Collections-Strings"} # ] # } # Find implementors of custom method result = interop_search_implementors("printOn:") # Returns all classes that override printOn: ``` -------------------------------- ### List Classes in Package - Python Source: https://context7.com/mumez/pharo-smalltalk-interop-mcp-server/llms.txt This function lists classes defined in a specific package in Pharo Smalltalk. It takes a package name as input and returns a dictionary with success and class names. Dependencies include the image's package system, and it's limited to direct definitions, not extensions. ```python from pharo_smalltalk_interop_mcp_server.core import interop_list_classes # Get classes in Kernel package result = interop_list_classes("Kernel") # Returns: { # "success": True, # "result": ["Object", "Behavior", "Class", "Metaclass", ...] # } # Get classes in custom package result = interop_list_classes("MyCustomPackage") # Returns: {"success": True, "result": ["MyClass1", "MyClass2"]} ``` -------------------------------- ### Retrieve Smalltalk Method Source Code in Python Source: https://context7.com/mumez/pharo-smalltalk-interop-mcp-server/llms.txt Obtains the source code of a specific method in a Smalltalk class via interop_get_method_source. Requires class name and method selector as inputs; outputs JSON with success/source or error for missing methods. Supports basic error handling for invalid selectors. ```python from pharo_smalltalk_interop_mcp_server.core import interop_get_method_source # Get method source from Object class result = interop_get_method_source("Object", "hash") # Returns: { # "success": True, # "result": "hash\n\t^ self identityHash" # } # Get method from Array result = interop_get_method_source("Array", "at:") # Returns: {"success": True, "result": "at: index\n\t^ self basicAt: index"} # Error handling for missing method result = interop_get_method_source("Object", "nonExistentMethod") # Returns: {"success": False, "error": "Method not found: Object>>nonExistentMethod"} ``` -------------------------------- ### Find Class References - Python Source: https://context7.com/mumez/pharo-smalltalk-interop-mcp-server/llms.txt This function locates methods that reference a specific class in Pharo Smalltalk. It depends on the interop server module and takes a class name, returning a dictionary with success and a list of referencing locations. Limitations include only static references and no handling of runtime references. ```python from pharo_smalltalk_interop_mcp_server.core import interop_search_references_to_class # Find where Object class is referenced result = interop_search_references_to_class("Object") # Returns: { # "success": True, # "result": [ # {"package": "Kernel", "class": "Behavior", "method": "new"}, # {"package": "System", "class": "ClassBuilder", "method": "createClass"} # ] # } # Find references to custom class result = interop_search_references_to_class("MyCustomClass") ``` -------------------------------- ### Read Roassal Visualizations - Python Source: https://context7.com/mumez/pharo-smalltalk-interop-mcp-server/llms.txt Inspects Roassal canvas elements and captures a screenshot. It returns a JSON object detailing the structure of Roassal canvases, including shapes, edges, and nodes. This is useful for analyzing graphical visualizations created with Roassal. ```python # Inspect Roassal visualizations result = interop_read_screen(target_type="roassal", capture_screenshot=True) # Returns: { # "success": True, # "result": { # "screenshot": "/tmp/pharo_screenshot_20250109_153047.png", # "target_type": "roassal", # "structure": { # "canvasCount": 1, # "canvases": [ # { # "class": "RSAthensMorph", # "canvasClass": "RSCanvas", # "visible": True, # "bounds": {"x": 203, "y": 145, "width": 490, "height": 467}, # "backgroundColor": "Color blue", # "zoomLevel": "1.0", # "canvasExtent": "(490.0@467.0)", # "shapeCount": 5, # "shapes": [ # { # "class": "RSCircle", # "color": "(Color r: 1.0 g: 0.0 b: 0.0 alpha: 0.2)", # "position": "(0.0@0.0)", # "extent": "(5.0@5.0)" # }, # { # "class": "RSLabel", # "text": "Node 1", # "color": "Color black", # "position": "(10.0@10.0)" # } # ], # "edgeCount": 3, # "edges": [ # { # "class": "RSLine", # "color": "Color gray", # "from": "node1", # "to": "node2" # } # ], # "nodeCount": 5 # } # ] # }, # "summary": "1 Roassal canvas(es)" # } # } ``` -------------------------------- ### List Extended Classes in Package - Python Source: https://context7.com/mumez/pharo-smalltalk-interop-mcp-server/llms.txt This function identifies classes extended by a specified package in Pharo Smalltalk. It inputs a package name and outputs extended classes, aiding in understanding dependencies. It relies on the image's extension mechanisms and may not capture all dynamic extensions. ```python from pharo_smalltalk_interop_mcp_server.core import interop_list_extended_classes # Find which classes MyPackage extends result = interop_list_extended_classes("MyPackage") # Returns: { # "success": True, # "result": ["String", "Array", "Object"] # Classes extended by MyPackage # } # Useful for understanding package dependencies result = interop_list_extended_classes("Network-HTTP") ```