Skip to main content
Glama

get_library_papers

Retrieve all papers from a NASA ADS library to access paper details in a specific collection. Use library ID to fetch complete bibliographic information.

Instructions

Get all papers from a specific library. Returns paper details for papers in the specified collection.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
library_idYesLibrary ID (from list_libraries)

Implementation Reference

  • The handler function that retrieves papers from a specific NASA ADS library by ID, fetches the bibcodes via API, queries paper details using ads.SearchQuery, and formats a list of papers with titles, authors, years, citations, and bibcodes.
    async def get_library_papers(library_id: str) -> list[TextContent]: """Get papers from a library.""" try: response = requests.get( f"{ADS_API_BASE}/biblib/libraries/{library_id}", headers=HEADERS, timeout=30 ) response.raise_for_status() data = response.json() bibcodes = data.get("documents", []) if not bibcodes: return [TextContent( type="text", text=f"No papers in library {library_id}" )] # Get paper details papers = ads.SearchQuery( q=f"bibcode:({' OR '.join(bibcodes)})", fl=["bibcode", "title", "author", "year", "citation_count"], rows=len(bibcodes) ) paper_lines = [f"Papers in library {data.get('name', library_id)}:\n"] for i, paper in enumerate(papers, 1): authors = paper.author[:2] if paper.author else ["Unknown"] author_str = ", ".join(authors) if paper.author and len(paper.author) > 2: author_str += " et al." paper_lines.append( f"{i}. {paper.title[0] if paper.title else 'No title'}\n" f" {author_str} ({paper.year}) | Citations: {paper.citation_count or 0}\n" f" Bibcode: {paper.bibcode}\n" ) return [TextContent(type="text", text="\n".join(paper_lines))] except Exception as e: logger.error(f"Error getting library papers: {e}") return [TextContent( type="text", text=f"Error getting library papers: {str(e)}" )]
  • The tool registration in the list_tools() function, defining the name, description, and input schema for get_library_papers.
    Tool( name="get_library_papers", description=( "Get all papers from a specific library. " "Returns paper details for papers in the specified collection." ), inputSchema={ "type": "object", "properties": { "library_id": { "type": "string", "description": "Library ID (from list_libraries)", }, }, "required": ["library_id"], }, ),
  • The dispatch logic in the call_tool() function that routes calls to the get_library_papers handler.
    elif name == "get_library_papers": return await get_library_papers(library_id=arguments["library_id"])
  • The input schema defining the required 'library_id' parameter as a string.
    inputSchema={ "type": "object", "properties": { "library_id": { "type": "string", "description": "Library ID (from list_libraries)", }, }, "required": ["library_id"], },

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/prtc/nasa-ads-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server