test-guided-tool-run
Use when user asks to "run tool as function", "test directly", or "call standalone" (outside MCP server). Essential for correct mock Context setup (MagicMock + AsyncMock). Finds integration tests with real test data.
- License 许可
- 自定义许可
- 最近更新
- 2026-11-11
- Stars
- ★ 80
- Forks
- 17
01 前言 Front Matter
- name
- test-guided-tool-run
- description
- Use when user asks to "run tool as function", "test directly", or "call standalone" (outside MCP server). Essential for correct mock Context setup (MagicMock + AsyncMock). Finds integration tests with real test data.
- user-invocable
- false
02 资源文件 5
- 参考文档agents/openai.yaml316 B
- 许可证LICENSE24.3 KB
- 脚本scripts/find_test.py3.8 KB
- 参考文档SOURCE.md359 B
- 参考文档TRUST.auto.yaml2.2 KB
03 SKILL.md 正文
Test-Guided Tool Run Skill
Before running any MCP tool directly (outside the MCP server), examine the corresponding integration test to understand the correct usage pattern.
Workflow
1. Find the Integration Test
python .claude/skills/test-guided-tool-run/scripts/find_test.py <tool_name>
Example:
python .claude/skills/test-guided-tool-run/scripts/find_test.py get_transaction_info
2. Read the Integration Test
The script outputs the test file path. Read it to understand:
- Import statements and mock context setup
- Real test data (addresses, transaction hashes, etc.)
- Expected response structure
3. Create Your Test Script
Use this template in /tmp/claude/.../scratchpad/:
#!/usr/bin/env python3
import asyncio
import sys
from pathlib import Path
from unittest.mock import AsyncMock, MagicMock
sys.path.insert(0, str(Path(__file__).parent.parent.parent.parent.parent))
from blockscout_mcp_server.tools.<category>.<tool_module> import <tool_function>
def create_mock_ctx():
"""Create a mock MCP Context object (pattern from tests/conftest.py)."""
ctx = MagicMock()
ctx.report_progress = AsyncMock()
ctx.info = AsyncMock()
return ctx
async def main():
ctx = create_mock_ctx()
try:
result = await <tool_function>(
# Your parameters here
ctx=ctx
)
print("Success! Result:")
print(result)
except Exception as e:
print(f"Error: {type(e).__name__}: {e}")
import traceback
traceback.print_exc()
if __name__ == "__main__":
asyncio.run(main())
4. Run Your Test Script
python /tmp/claude/.../scratchpad/your_test_script.py
04 同仓库更多 Skills
recipe-performance
Diagnose a specific MetaMask user flow's real-app performance and Sentry critical-user-flow telemetry with deterministic mm-harness recipes. Use for CUF boundaries, cold/warm/background-resume behavior, latency regressions, lifecycle tags, duplicate or blocking network requests, long tasks, layout/paint cost, screen redraws, React rerenders, or browser trace analysis where tests alone cannot prove the real app.
mexc-spot-websocket
MEXC Spot WebSocket workflows for public streams, protobuf handling, depth maintenance, listen keys, and private streams without exposing API keys.
mexc-spot-rest
MEXC Spot REST workflows for public data, signed account requests, orders, wallet/admin actions, and secure signing without exposing API keys.
mexc-futures-websocket
MEXC Futures WebSocket workflows for public streams, private account/order/position streams, ping/pong, subscriptions, and depth maintenance.
0xklen-version-and-refresh-sanctions-lists
暂无简介
verify-tests-cover-changed-lines
Use when a PR adds code that the existing suite may not exercise. Measures patch coverage — the share of newly changed lines hit by tests — before approving.