Add ASCL tools for astrophysics code discovery#69
Open
pushwithak wants to merge 1 commit into
Open
Conversation
Collaborator
|
@pushwithak this also has ADS as well? Could be just ASCL only PR. |
369e33b to
8626adf
Compare
Author
|
It was dependent since ascl was built on ads (it was using the same _helpers.py). I updated it as ASCL only. |
Author
|
Updated. This has only ascl now. |
6bfa781 to
2135868
Compare
One MCP tool wrapping the Astrophysics Source Code Library search API (https://ascl.net/api/search/) for code discovery. ASCLSearchTool: search ASCL for codes by name or capability, or look up a specific entry by its ASCL id. Returns ascl_id, title, credit (semicolon-separated authors), abstract, site_list (all URLs), bibcode (the ASCL record's own ADS bibcode), described_in (ADS URLs for description papers), used_in (ADS URLs for papers that used the code), used_in_count, and views. The tool auto-detects ASCL id-shaped queries (e.g. '1303.002', 'ascl:1303.002') and rewrites them as ascl_id:"..." for exact lookup, so a single tool covers both name search and id lookup. Design: - ASCL API quirks handled inside the tool: list-valued fields (site_list, described_in, used_in) come back as PHP-serialized strings, parsed via _parse_php_array. `views` is a string and is converted to int. - Query must be quoted ("...") — the API returns 404 otherwise. - Per-request httpx.AsyncClient, errors returned via output.error, no retry logic.
2135868 to
04ccb8b
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds an MCP tool wrapping the Astrophysics Source Code Library (ASCL) for astrophysics code discovery.
Tool
ASCLSearchToolSearch ASCL by name, capability keyword, or ASCL id. Returns each code's ascl_id, title, authors (credit), abstract, all associated URLs (site_list), ADS bibcode of the ASCL record itself, ADS URLs for describing papers and papers that used the code, usage count, and view count.
The tool auto-detects id-shaped queries (
1303.002,ascl:1303.002) and formats them as exact-match lookups, so one tool covers both name search and id lookup.API quirks handled
site_list,described_in,used_income back as PHP-serialized strings — parsed via_parse_php_array.qto be wrapped in quotes — returns 404 otherwise.viewstype: comes back as a string; converted to int with a fallback to 0.Design
base_url(env override viaASCL_API_URL),timeout.httpx.AsyncClient— matches the pattern ofsde_searchand the eie tools.output.errorinstead of raising.Testing
tests/tools/test_ascl.py— 10 integration tests against the live ASCL API.