create_library
Organize astronomical papers into custom collections by topic, project, or reading status using the NASA ADS system.
Instructions
Create a new paper library/collection. Useful for organizing papers by topic, project, or reading status.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | Name for the library (e.g., 'Stellar Populations Review') | |
| description | No | Description of the library | |
| public | No | Whether the library should be public (default: false) |
Implementation Reference
- src/nasa_ads_mcp/server.py:738-769 (handler)The main handler function that executes the create_library tool logic: POSTs to ADS API /biblib/libraries endpoint with name, description, public params, returns success message with new library ID or error.async def create_library(name: str, description: str = "", public: bool = False) -> list[TextContent]: """Create a new library.""" try: payload = { "name": name, "description": description, "public": public } response = requests.post( f"{ADS_API_BASE}/biblib/libraries", headers=HEADERS, json=payload, timeout=30 ) response.raise_for_status() data = response.json() library_id = data.get("id") return [TextContent( type="text", text=f"✓ Created library '{name}'\nLibrary ID: {library_id}\n\nUse add_to_library to add papers to this library." )] except Exception as e: logger.error(f"Error creating library: {e}") return [TextContent( type="text", text=f"Error creating library: {str(e)}" )]
- src/nasa_ads_mcp/server.py:216-234 (schema)Pydantic/input schema defining the expected input parameters for the create_library tool.inputSchema={ "type": "object", "properties": { "name": { "type": "string", "description": "Name for the library (e.g., 'Stellar Populations Review')", }, "description": { "type": "string", "description": "Description of the library", }, "public": { "type": "boolean", "description": "Whether the library should be public (default: false)", "default": False, }, }, "required": ["name"], },
- src/nasa_ads_mcp/server.py:210-235 (registration)Registration of the create_library tool in the list_tools() function, including name, description, and input schema.Tool( name="create_library", description=( "Create a new paper library/collection. " "Useful for organizing papers by topic, project, or reading status." ), inputSchema={ "type": "object", "properties": { "name": { "type": "string", "description": "Name for the library (e.g., 'Stellar Populations Review')", }, "description": { "type": "string", "description": "Description of the library", }, "public": { "type": "boolean", "description": "Whether the library should be public (default: false)", "default": False, }, }, "required": ["name"], }, ),
- src/nasa_ads_mcp/server.py:300-305 (helper)Dispatch logic in the main call_tool handler that routes 'create_library' calls to the implementation function with parsed arguments.elif name == "create_library": return await create_library( name=arguments["name"], description=arguments.get("description", ""), public=arguments.get("public", False) )