Skip to main content
Glama
nickweedon

Skeleton MCP Server

by nickweedon
BUGFIX_2025-12-07.md3.26 kB
# Bug Fix: Tool Name Mapping Error **Date**: 2025-12-07 **Issue**: `playwright_screenshot` tool failing with "Tool not found" error ## Problem When users tried to take screenshots using the `playwright_screenshot` tool, they received this error: ``` RuntimeError: Tool 'browser_screenshot' not found. Available tools: ['browser_close', 'browser_resize', ..., 'browser_take_screenshot', ...] ``` ## Root Cause The proxy server was using a **simple prefix replacement strategy** to map tool names: - `playwright_screenshot` → `browser_screenshot` (WRONG) But playwright-mcp's actual tool name is: - `browser_take_screenshot` (CORRECT) The code in [server.py:157-163](src/playwright_proxy_mcp/server.py#L157-L163) was using: ```python actual_tool_name = ( tool_name.replace("playwright_", "browser_", 1) if tool_name.startswith("playwright_") else tool_name ) ``` This simple prefix replacement doesn't account for playwright-mcp's naming conventions where some tools have different structures (e.g., `take_screenshot` vs just `screenshot`). ## Solution Implemented an **explicit tool name mapping** with fallback to simple prefix replacement: ```python TOOL_NAME_MAP = { "playwright_screenshot": "browser_take_screenshot", "playwright_navigate": "browser_navigate", "playwright_click": "browser_click", "playwright_fill": "browser_fill_form", "playwright_get_visible_text": "browser_snapshot", } actual_tool_name = TOOL_NAME_MAP.get( tool_name, tool_name.replace("playwright_", "browser_", 1) if tool_name.startswith("playwright_") else tool_name ) ``` ## Files Modified 1. **[src/playwright_proxy_mcp/server.py](src/playwright_proxy_mcp/server.py#L160-L173)** - Added `TOOL_NAME_MAP` dictionary with explicit mappings - Updated `_call_playwright_tool()` to use the map with fallback 2. **[tests/test_tool_mapping.py](tests/test_tool_mapping.py)** (NEW) - Added regression tests for tool name mapping - Verifies all mapped tools exist in playwright-mcp - Tests both explicit mappings and fallback behavior ## Testing All tests pass: ```bash $ uv run pytest tests/test_tool_mapping.py -v tests/test_tool_mapping.py::test_tool_name_mapping PASSED [ 33%] tests/test_tool_mapping.py::test_screenshot_mapping PASSED [ 66%] tests/test_tool_mapping.py::test_mapping_logic PASSED [100%] ``` ## Impact - ✅ `playwright_screenshot` now works correctly - ✅ Other tools like `playwright_fill` also correctly map to `browser_fill_form` - ✅ Backward compatible - tools using simple prefix replacement still work - ✅ Future-proof - new tools can use fallback or be added to the map as needed ## Related Issues This also addresses potential future issues with: - `playwright_fill` → should map to `browser_fill_form` (not `browser_fill`) - `playwright_get_visible_text` → should map to `browser_snapshot` (not `browser_get_visible_text`) ## Additional Notes There's also a secondary issue noted in the logs (line 130): ``` Error: Browser specified in your config is not installed. ``` This is a separate issue where the Chromium browser needs to be installed in the playwright-mcp subprocess, but that's unrelated to the tool name mapping bug fixed here.

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/nickweedon/playwritght-proxy-mcp'

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