Skip to content

160-tool MCP server for real-time global intelligence from free public APIs: markets, liquidity, prediction markets, SEC filings, conflict, military, aircraft-cohort early warning, migration and border flows, cyber, climate, news and more. Dated observation history, 29 research prompts, cited briefs, geofences, SSE dashboard. MIT, no paid API keys.

arXiv papers: a call without query searches the default categories

Phoenix Agent (mac-studio)85c1fdbcf9e8
diff --git a/CHANGELOG.md b/CHANGELOG.md
index da88c66..58d185a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -274,6 +274,10 @@ source here, and no proxy is substituted for any of these measures.
`yields_source` says whether the maturities came from FRED or Yahoo. A
maturity with no rate is listed in `data_gaps` with `degraded: true`, and
no rate at all is an `error`.
+- `intel_arxiv_papers` without `query` raised a TypeError before any
+ request; it now searches the default AI, ML and NLP categories. The
+ search also goes into the first request: before, the first request was
+ sent to the bare API URL and the query only reached a fallback.
### Added: tropical cyclone forecast tracks
- `intel_cyclones` and `intel_jtwc_cyclones` take `include_forecast`
diff --git a/src/world_intel_mcp/sources/arxiv_papers.py b/src/world_intel_mcp/sources/arxiv_papers.py
index 1b3deb6..fe35462 100644
--- a/src/world_intel_mcp/sources/arxiv_papers.py
+++ b/src/world_intel_mcp/sources/arxiv_papers.py
@@ -69,9 +69,12 @@ def _parse_arxiv_xml(xml_text: str) -> list[dict]:
return papers
+DEFAULT_QUERY = "cat:cs.AI OR cat:cs.LG OR cat:cs.CL"
+
+
async def fetch_arxiv_papers(
fetcher: Fetcher,
- query: str = "cat:cs.AI OR cat:cs.LG OR cat:cs.CL",
+ query: str | None = DEFAULT_QUERY,
limit: int = 25,
sort_by: str = "submittedDate",
) -> dict:
@@ -79,7 +82,8 @@ async def fetch_arxiv_papers(
Args:
fetcher: Shared HTTP fetcher.
- query: arXiv search query (default: AI/ML/NLP categories).
+ query: arXiv search query (default: AI/ML/NLP categories); None or
+ empty means the default.
limit: Number of papers (max 50).
sort_by: Sort field — "submittedDate", "relevance", or "lastUpdatedDate".
@@ -87,30 +91,26 @@ async def fetch_arxiv_papers(
Dict with papers[], count, source, timestamp.
"""
limit = min(limit, 50)
+ query = query or DEFAULT_QUERY
safe_query = re.sub(r"[^a-zA-Z0-9:._\s|()]", "", query)[:128]
- xml_text = await fetcher.get_xml(
+ # The search goes in the query string of the first and only request: a
+ # bare request to the API URL would not search for anything.
+ xml_text = await fetcher.get_text(
_ARXIV_API_URL,
source="arxiv",
cache_key=f"arxiv:{safe_query}:{sort_by}:{limit}",
cache_ttl=900,
+ params={
+ "search_query": query,
+ "sortBy": sort_by,
+ "sortOrder": "descending",
+ "max_results": limit,
+ },
timeout=20.0,
)
- # get_xml doesn't support params, so construct URL manually
- # Actually, we need to use get_text with params
- if xml_text is None:
- # Try with full URL including params
- url = f"{_ARXIV_API_URL}?search_query={query}&sortBy={sort_by}&sortOrder=descending&max_results={limit}"
- xml_text = await fetcher.get_text(
- url,
- source="arxiv",
- cache_key=f"arxiv:{safe_query}:{sort_by}:{limit}",
- cache_ttl=900,
- timeout=20.0,
- )
-
if xml_text is None:
return {"papers": [], "count": 0, "source": "arxiv", "timestamp": _utc_now_iso()}
diff --git a/src/world_intel_mcp/tests/test_sources.py b/src/world_intel_mcp/tests/test_sources.py
index ec4122a..37eec23 100644
--- a/src/world_intel_mcp/tests/test_sources.py
+++ b/src/world_intel_mcp/tests/test_sources.py
@@ -1007,6 +1007,58 @@ async def test_fetch_arxiv_papers(fetcher: Fetcher) -> None:
assert len(result["papers"][0]["authors"]) == 2
+_ARXIV_ONE_ENTRY = """<?xml version="1.0" encoding="UTF-8"?>
+<feed xmlns="http://www.w3.org/2005/Atom"><entry>
+<id>http://arxiv.org/abs/2610.00001v1</id><title>One paper</title>
+<summary>s</summary><published>2026-10-16T00:00:00Z</published>
+</entry></feed>"""
+
+
+async def test_arxiv_tool_without_query_searches_the_default(fetcher: Fetcher, monkeypatch) -> None:
+ """The schema and the guide present query as optional; the handler
+ used to pass None into the source, which raised before any request."""
+ from types import SimpleNamespace
+
+ from world_intel_mcp.sources import arxiv_papers
+ from world_intel_mcp.tools import society
+
+ default = "cat:cs.AI OR cat:cs.LG OR cat:cs.CL"
+ route = respx.get(url__regex=r".*export\.arxiv\.org/api/query.*").mock(
+ return_value=httpx.Response(200, text=_ARXIV_ONE_ENTRY)
+ )
+ monkeypatch.setattr(society, "runtime", SimpleNamespace(fetcher=fetcher))
+ result = await society.HANDLERS["intel_arxiv_papers"]({})
+
+ assert result["count"] == 1
+ assert result["query"] == default == getattr(arxiv_papers, "DEFAULT_QUERY", default)
+ assert route.call_count == 1
+ assert dict(route.calls[0].request.url.params) == {
+ "search_query": default,
+ "sortBy": "submittedDate",
+ "sortOrder": "descending",
+ "max_results": "25",
+ }
+
+
+async def test_arxiv_first_request_carries_the_search(fetcher: Fetcher) -> None:
+ """A bare request to the API URL searches for nothing; the query must
+ be in the first request, not only in a fallback."""
+ from world_intel_mcp.sources.arxiv_papers import fetch_arxiv_papers
+
+ route = respx.get(url__regex=r".*export\.arxiv\.org/api/query.*").mock(
+ return_value=httpx.Response(200, text=_ARXIV_ONE_ENTRY)
+ )
+ result = await fetch_arxiv_papers(fetcher, query="cat:cs.CV", limit=3)
+
+ assert result["count"] == 1
+ assert [dict(c.request.url.params).get("search_query") for c in route.calls] == ["cat:cs.CV"]
+ assert dict(route.calls[0].request.url.params)["max_results"] == "3"
+
+
# ---------------------------------------------------------------------------
# USA Spending
# ---------------------------------------------------------------------------