Skip to main content
Glama

add_to_library

Add selected papers to an existing NASA ADS library by providing the library ID and bibcodes to organize astronomical research collections.

Instructions

Add papers to an existing library. Provide library ID and list of bibcodes to add.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
library_idYesLibrary ID (from list_libraries)
bibcodesYesList of bibcodes to add to the library

Implementation Reference

  • The core handler function that executes the tool: sends POST request to ADS API to add bibcodes to the specified library.
    async def add_to_library(library_id: str, bibcodes: list[str]) -> list[TextContent]: """Add papers to a library.""" try: payload = { "bibcode": bibcodes, "action": "add" } response = requests.post( f"{ADS_API_BASE}/biblib/documents/{library_id}", headers=HEADERS, json=payload, timeout=30 ) response.raise_for_status() return [TextContent( type="text", text=f"✓ Added {len(bibcodes)} paper(s) to library {library_id}" )] except Exception as e: logger.error(f"Error adding to library: {e}") return [TextContent( type="text", text=f"Error adding to library: {str(e)}" )]
  • Tool registration in list_tools(), including name, description, and input schema definition.
    Tool( name="add_to_library", description=( "Add papers to an existing library. " "Provide library ID and list of bibcodes to add." ), inputSchema={ "type": "object", "properties": { "library_id": { "type": "string", "description": "Library ID (from list_libraries)", }, "bibcodes": { "type": "array", "items": {"type": "string"}, "description": "List of bibcodes to add to the library", }, }, "required": ["library_id", "bibcodes"], }, ),
  • Dispatch logic in the central call_tool() function that invokes the add_to_library handler with parsed arguments.
    elif name == "add_to_library": return await add_to_library( library_id=arguments["library_id"], bibcodes=arguments["bibcodes"] )
  • Input schema definition for the tool, specifying required parameters library_id and bibcodes.
    inputSchema={ "type": "object", "properties": { "library_id": { "type": "string", "description": "Library ID (from list_libraries)", }, "bibcodes": { "type": "array", "items": {"type": "string"}, "description": "List of bibcodes to add to the library", }, }, "required": ["library_id", "bibcodes"], },

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