Skip to content

Add ADS tools for astrophysics paper and link discovery#68

Open
pushwithak wants to merge 1 commit intoNASA-IMPACT:developfrom
pushwithak:add-ads-tool
Open

Add ADS tools for astrophysics paper and link discovery#68
pushwithak wants to merge 1 commit intoNASA-IMPACT:developfrom
pushwithak:add-ads-tool

Conversation

@pushwithak
Copy link
Copy Markdown

@pushwithak pushwithak commented Apr 13, 2026

Summary

Adds two MCP tools wrapping Astrophysics Data System (ADS) API for astrophysics paper discovery and citation-evidence retrieval.

Tools

ADSSearchTool

Search the ADS literature index. Input: a query (Solr syntax supported), rows cap, optional fq filter. Output: papers with bibcode, title, authors, abstract, citation_count, DOI, publication, and names of linked data archives (HEASARC, MAST, Chandra, XMM, etc.).

ADSLinksResolverTool

Given an ADS bibcode, return its "associated" bibcodes — the same records ADS shows under "Described in" on the record page. For ASCL record bibcodes (e.g. 2010ascl.soft10082F), the associated bibcodes are the code's canonical method/description papers.

This tool exists specifically for canonical-paper recovery. ASCL's own described_in field is often incomplete: the FLASH ASCL record lists only the 2005 update paper (~14 citations) and misses the canonical Fryxell+ 2000 paper (~2100 citations). The ADS resolver is the only reliable way to recover the canonical paper programmatically.

Design

  • One shared ADSToolConfig (base_url, api_token, timeout) — both tools hit the same API.
  • Per-request httpx.AsyncClient
  • Errors return via output.error instead of raising, so agents can report failures without crashing the pipeline.

Environment

Testing

tests/tools/test_ads.py — 10 integration tests against the live ADS API (module-level skip when ADS_API_TOKEN is unset).

uv run pytest tests/tools/test_ads.py -n0

@pushwithak
Copy link
Copy Markdown
Author

@NISH1001

1 similar comment
@pushwithak
Copy link
Copy Markdown
Author

@NISH1001

Comment thread akd_ext/tools/_helpers.py Outdated
Comment thread akd_ext/tools/ads.py Outdated
Comment thread akd_ext/tools/ads.py Outdated
Comment thread akd_ext/tools/ads.py Outdated
Comment thread akd_ext/tools/ads.py Outdated
Comment thread akd_ext/tools/ads.py Outdated
Comment thread akd_ext/tools/ads.py Outdated
Comment thread akd_ext/tools/_helpers.py Outdated
Comment on lines +71 to +73
def _is_retryable_status(response: httpx.Response) -> bool:
"""Return True if the response status code is retryable."""
return response.status_code in _RETRY_STATUS
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be a lambda function tiself probably.

Comment thread akd_ext/tools/_helpers.py Outdated
@retry(
retry=retry_any(
retry_if_exception_type((httpx.ConnectError, httpx.ReadError, httpx.RemoteProtocolError)),
retry_if_result(_is_retryable_status),
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe just lambda is okay to have here

Comment thread akd_ext/tools/_helpers.py Outdated
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the helpers might need a little bit of rework probably. Just wanted to make sure we're not introducing any claude-bloat to things that might not needed

Copy link
Copy Markdown
Collaborator

@NISH1001 NISH1001 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pushwithak let's simplify this and no helper. Avoid any complicated retry etc

Two MCP tools wrapping Astrophysics Data System API:

- ADSSearchTool: search the literature for papers matching a query.
  Returns bibcode, title, authors, abstract, citation_count, DOI,
  publication, and names of linked data archives (HEASARC, MAST,
  Chandra, etc.).

- ADSLinksResolverTool: given an ADS bibcode, return its "associated"
  bibcodes — the records ADS shows under "Described in" on the record
  page. For ASCL record bibcodes, the associated bibcodes are the
  code's canonical method papers, which is the authoritative source
  for canonical-paper recovery (ASCL's own described_in is often
  incomplete).

Shared ADSToolConfig (base_url, api_token, timeout). Per-request
httpx clients, errors returned via output.error, no retry logic —
matches the pattern of sde_search and the eie tools.

Requires ADS_API_TOKEN env var.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants