Skip to main content
Glama
prtc
by prtc

list_libraries

Retrieve your personal paper libraries from NASA ADS, showing library names, descriptions, and paper counts for organized research management.

Instructions

List all your personal paper libraries/collections in ADS. Shows library names, descriptions, and paper counts.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The main handler function for the 'list_libraries' tool. Fetches and lists the user's personal paper libraries from the NASA ADS API.
    async def list_libraries() -> list[TextContent]:
        """List all user libraries."""
        try:
            response = requests.get(
                f"{ADS_API_BASE}/biblib/libraries",
                headers=HEADERS,
                timeout=30
            )
            response.raise_for_status()
            
            data = response.json()
            libraries = data.get("libraries", [])
            
            if not libraries:
                return [TextContent(
                    type="text",
                    text="No libraries found. Create one with the create_library tool!"
                )]
            
            lib_lines = ["Your ADS Libraries:\n"]
            for lib in libraries:
                lib_lines.append(
                    f"• {lib.get('name', 'Unnamed')} (ID: {lib.get('id', 'unknown')})\n"
                    f"  {lib.get('description', 'No description')}\n"
                    f"  Papers: {lib.get('num_documents', 0)} | "
                    f"{'Public' if lib.get('public') else 'Private'}\n"
                )
            
            return [TextContent(type="text", text="\n".join(lib_lines))]
        
        except Exception as e:
            logger.error(f"Error listing libraries: {e}")
            return [TextContent(
                type="text",
                text=f"Error listing libraries: {str(e)}"
            )]
  • Registers the 'list_libraries' tool in the MCP server's list_tools() method, including its name, description, and empty input schema (no parameters required).
    Tool(
        name="list_libraries",
        description=(
            "List all your personal paper libraries/collections in ADS. "
            "Shows library names, descriptions, and paper counts."
        ),
        inputSchema={
            "type": "object",
            "properties": {},
        },
    ),
  • The input schema for the 'list_libraries' tool, which requires no input parameters.
        inputSchema={
            "type": "object",
            "properties": {},
        },
    ),
  • Dispatch logic in the main call_tool handler that routes 'list_libraries' calls to the specific implementation function.
    elif name == "list_libraries":
        return await list_libraries()

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