Skip to main content
Glama
prtc
by prtc

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"],
    },
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden. It implies a write operation ('Add') but doesn't disclose behavioral traits such as permissions required, whether additions are idempotent, error handling for invalid bibcodes, or rate limits. This is a significant gap for a mutation tool with zero annotation coverage.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is appropriately sized and front-loaded with a clear purpose in a single sentence. Every word earns its place, with no redundant information, making it efficient and easy to parse.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity of a write operation with no annotations and no output schema, the description is incomplete. It lacks details on behavioral aspects (e.g., success/failure responses, side effects) and doesn't compensate for the absence of structured data, leaving gaps for an AI agent to understand the tool fully.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents both parameters ('library_id' and 'bibcodes'). The description adds minimal value by restating the parameters without providing additional context, such as format examples for bibcodes or how to obtain the library ID beyond referencing 'list_libraries'.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb ('Add') and resource ('papers to an existing library'), making the purpose specific and understandable. It distinguishes from siblings like 'create_library' (creates new) and 'list_libraries' (lists), but could be more explicit about differentiation from 'get_library_papers' (reads vs. writes).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It mentions 'existing library' but doesn't specify prerequisites (e.g., library must exist), exclusions, or comparisons to siblings like 'create_library' for new libraries or 'search_papers' for finding papers to add.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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