RivalSearchMCP / tests
CLAUDE.md140 starsChanged 6 months agoMITView on GitHub
This guide helps AI coding agents run tests for RivalSearchMCP tools efficiently. Test one tool at a time for focused debugging: This file provides a reusable create_client() function: Each test file: - Tests ONE tool comprehensively - Tests ALL parameters for that tool - Uses real websites (not example.com) - Has clear assertions (no cheating!) - Runs independently with uv run python tests/tools/test_<tool>.py No pytest - Just plain asyncio.run(): DO THIS: 1. Test ONE tool at a time 2. Run:…
In this repository5 other files it gives its agents.
- AGENTS.mdAGENTS.md
- tests/AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- docs/llms.txtllms.txt
- rival-search-mcpSkill
The file
We split this CLAUDE.md into the rules it gives an agent
11 rules. About 0 are common, 10 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈10
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 9
Test one tool at a time for focused debugging:
- Distinctive: line 87
Test ONE tool at a time
- Distinctive: line 89
Read the output carefully
- Distinctive: line 90
If test fails, fix the tool's source code
- Distinctive: line 176
Make sure you're running from the project root:
- Distinctive: line 186
If a test hangs >60 seconds, interrupt and investigate
- Distinctive: line 204
Look for specific assertion messages
- Distinctive: line 205
Check character counts (many tests verify content length)
- Distinctive: line 210
If test fails, fix the TOOL, not the TEST
- Very specific: line 233
Test one tool at a time: uv run python tests/tools/test_<tool>.py
- Distinctive: line 243
Remember: Test individually, fix iteratively, verify thoroughly!
≈ “Common” is an estimate: at least 1 in 5 of the 26,980 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
AGENTS.md - Testing Guide for AI Coding Agents
This guide helps AI coding agents run tests for RivalSearchMCP tools efficiently.
Quick Start
Test Individual Tools (RECOMMENDED)
Test one tool at a time for focused debugging:
# Navigate to project root
cd /Users/damionrashford/mcp-expert/servers/RivalSearchMCP
# Test individual tools (run these ONE AT A TIME)
uv run python tests/tools/test_multi_search.py
uv run python tests/tools/test_trends_core.py
uv run python tests/tools/test_trends_export.py
uv run python tests/tools/test_content_operations.py
uv run python tests/tools/test_traverse_website.py
uv run python tests/tools/test_research_topic.py
uv run python tests/tools/test_scientific_research.py
uv run python tests/tools/test_research_workflow.pyTest Structure
tests/
├── AGENTS.md # This file
├── mcp_client.py # Reusable MCP client
├── run.py # Helper runner (optional)
└── tools/ # Individual test files
├── test_multi_search.py # Tests multi_search tool
├── test_trends_core.py # Tests trends_core tool
├── test_trends_export.py # Tests trends_export tool
├── test_content_operations.py # Tests content_operations tool
├── test_traverse_website.py # Tests traverse_website tool
├── test_research_topic.py # Tests research_topic tool
├── test_scientific_research.py # Tests scientific_research tool
└── test_research_workflow.py # Tests research_workflow toolHow Tests Work
1. MCP Client (mcp_client.py)
This file provides a reusable create_client() function:
from tests.mcp_client import create_client
async with create_client() as client:
result = await client.call_tool("multi_search", {"query": "Python"})
print(result.content[0].text)2. Individual Test Files
Each test file:
- Tests ONE tool comprehensively
- Tests ALL parameters for that tool
- Uses real websites (not example.com)
- Has clear assertions (no cheating!)
- Runs independently with
uv run python tests/tools/test_<tool>.py
3. Simple Execution Model
No pytest - Just plain asyncio.run():
async def test_something():
async with create_client() as client:
result = await client.call_tool(...)
assert len(result.content[0].text) > 500
print("✅ Test passed")
if __name__ == "__main__":
asyncio.run(test_something())For AI Coding Agents
When User Asks: "Test the tools"
DO THIS:
- Test ONE tool at a time
- Run:
uv run python tests/tools/test_<tool_name>.py - Read the output carefully
- If test fails, fix the tool's source code
- Re-run the same test
- Move to next tool only when current one passes
DON'T DO THIS:
- ❌ Run all tests at once
- ❌ Skip tests that take time
- ❌ Assume tests pass without running them
- ❌ Run tests in parallel
Example Workflow
# Test multi_search
cd /Users/damionrashford/mcp-expert/servers/RivalSearchMCP
uv run python tests/tools/test_multi_search.py
# If it passes, move to next tool
uv run python tests/tools/test_trends_core.py
# If it fails, fix the source code, then re-test
# Fix: src/tools/trends.py
uv run python tests/tools/test_trends_core.py # Re-run same testReading Test Output
Successful test:
✅ Default params test passed - 523 chars
✅ num_results=3 test passed
✅ extract_content flag test passed
✅ use_fallback test passed
✅ Quality test passed - 1247 chars
✅ All multi_search tests passed!Failed test:
Traceback (most recent call last):
...
AssertionError: Search results too short: 234 chars (expected >500)Understanding Test Coverage
Each test file tests ALL parameters:
- test_multi_search.py (5 tests)
- query, num_results, extract_content, follow_links, max_depth, use_fallback
- test_trends_core.py (6 tests)
- operation (search/related/regional/compare), keywords, timeframe, geo, resolution
- test_trends_export.py (6 tests)
- keywords, format (csv/json/sql), timeframe, filename
- test_content_operations.py (10 tests)
- operation (retrieve/stream/analyze/extract), url, content, extraction_method, analysis_type, link_type
- test_traverse_website.py (7 tests)
- url, mode (research/docs/map), max_pages, max_depth, generate_llms_txt
- test_research_topic.py (6 tests)
- topic, sources, max_sources, include_analysis
- test_scientific_research.py (9 tests)
- operation (academic_search/dataset_discovery), query, max_results, sources, categories
- test_research_workflow.py (10 tests)
- topic, max_sources, include_trends, include_website_analysis, research_depth, ai_model, enable_ai_insights
Total: 59 test functions across 8 tools
Troubleshooting
"ModuleNotFoundError: No module named 'fastmcp'"
cd /Users/damionrashford/mcp-expert/servers/RivalSearchMCP
uv sync"No module named 'tests'"
Make sure you're running from the project root:
cd /Users/damionrashford/mcp-expert/servers/RivalSearchMCP
uv run python tests/tools/test_multi_search.pyTests hang or timeout
- Tests make real network requests (search engines, websites)
- Some tests may take 10-30 seconds
- If a test hangs >60 seconds, interrupt and investigate
"AssertionError: Output too short"
This means the tool isn't returning quality content. Fix the tool's source code in src/tools/<tool_name>.py.
Best Practices for Agents
- Always test after making changes
- Modified
src/tools/trends.py? → Runtests/tools/test_trends_core.py - Modified
src/tools/analysis.py? → Runtests/tools/test_content_operations.py
- Modified
- Test individual tools, not all at once
- Easier to debug
- Faster feedback loop
- Can run in any order
- Read test output carefully
- Look for specific assertion messages
- Check character counts (many tests verify content length)
- Review error traces to find root cause
- Don't modify tests to make them pass
- Tests are correct
- If test fails, fix the TOOL, not the TEST
- Tests ensure quality content, not just "no errors"
- UV commands
uv sync # Install dependencies uv run <command> # Run in UV environment uv add <package> # Add dependency
Test Quality Standards
Each test verifies:
- ✅ Tool executes without errors
- ✅ Returns content meeting minimum length (e.g., >500 chars)
- ✅ Contains expected data structures (URLs, markdown, etc.)
- ✅ Matches tool's stated purpose
These are REAL tests - they will fail if tools are broken!
Summary
For agents:
- Test one tool at a time:
uv run python tests/tools/test_<tool>.py - Fix issues immediately when tests fail
- Re-run same test after fixing
- Move to next tool only when current passes
Files:
mcp_client.py- Reusable MCP clienttools/test_*.py- 8 comprehensive test files (59 tests total)run.py- Optional helper
Remember: Test individually, fix iteratively, verify thoroughly!
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

