Yuan1z0825/nature-skills / skills/nature-academic-search
nature-academic-search
FlaggedSearch literature across sources, verify or manage citations, and build MeSH strategies or citation-impact audits. Use for 文献检索、引文核对、参考文献管理、严格他引 and evidence-backed citer profiles; not for translating a paper or drafting manuscript prose.
mcp-server/tests/test_mcp_tools.py
View on GitHub"""MCP dispatch tests for academic_search_server tools."""
from __future__ import annotations
import asyncio
import json
def _call_tool_json(tool_name: str, arguments: dict) -> dict:
from academic_search_server import mcp
content, _metadata = asyncio.run(mcp.call_tool(tool_name, arguments))
return json.loads(content[0].text)
def test_search_papers_mcp_dispatch_uses_default_sources(monkeypatch):
import academic_search_server
captured = {}
async def fake_search_all(query, sources, rows, filter_type):
captured.update({
"query": query,
"sources": list(sources),
"rows": rows,
"filter_type": filter_type,
})
return {
"total": 0,
"sources_queried": list(sources),
"result_count": 0,
"results": [],
"errors": None,
}
monkeypatch.setattr(academic_search_server, "_search_all", fake_search_all)
payload = _call_tool_json("search_papers", {"query": "graphene", "rows": 100})
assert payload["sources_queried"] == ["crossref", "pubmed", "arxiv"]
assert "error" not in payload
assert captured == {
"query": "graphene",
"sources": ["crossref", "pubmed", "arxiv"],
"rows": 50,
"filter_type": None,
}
def test_search_papers_mcp_dispatch_accepts_elsevier_sources(monkeypatch):
import academic_search_server
captured = {}
async def fake_search_all(query, sources, rows, filter_type):
captured.update({
"query": query,
"sources": list(sources),
"rows": rows,
"filter_type": filter_type,
})
return {
"total": 2,
"sources_queried": list(sources),
"result_count": 2,
"results": [
{"source": "scopus", "title": "Scopus result"},
{"source": "sciencedirect", "title": "ScienceDirect result"},
],
"errors": None,
}
monkeypatch.setattr(academic_search_server, "_search_all", fake_search_all)
payload = _call_tool_json(
"search_papers",
{
"query": "bridge scour",
"sources": ["scopus", "sciencedirect"],
"rows": 1,
"type": "journal-article",
},
)
assert payload["sources_queried"] == ["scopus", "sciencedirect"]
assert {item["source"] for item in payload["results"]} == {
"scopus",
"sciencedirect",
}
assert captured == {
"query": "bridge scour",
"sources": ["scopus", "sciencedirect"],
"rows": 1,
"filter_type": "journal-article",
}
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| rea-analysis-optimizationmorluto/reaOptimize REA providers and shared analysis workflows for agent context, latency, CPU, and memory while preserving correctness and Evidence. Use for analysis bottlenecks and cache or query design; CI/test-suite optimization belongs to rea-ci-tests-audit. | Stars: 472k | Updated | Claude CodeCodex | Verified | Install |
| rea-ci-tests-auditmorluto/reaAudit REA CI and test suites for correctness, fixture drift, false passes, and measured performance; use for suite or workflow investigations and efficiency changes, rather than ordinary feature testing or a single test failure. | Stars: 472k | Updated | Claude CodeCodex | Verified | Install |
| rea-tool-designmorluto/reaAudit, investigate, design, or change REA investigation tools, CLI/MCP contracts, provider capabilities, and Evidence semantics. | Stars: 472k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-auditDietrichGebert/ponytailQuality audit of the whole repo: bugs, security, real load, missing tests, speed, and what to delete. Most important first. | Stars: 196k | Updated | Claude CodeCodex | Verified | Install |