Skip to main content
Glama
xytangme

NeoDB MCP Server

Official
by xytangme

get-book

Retrieve detailed book information from NeoDB's catalog using a book ID to access descriptions, metadata, and catalog data for specific titles.

Instructions

Get detailed information about a specific book

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
book_idYesThe ID of the book to retrieve

Implementation Reference

  • Registration of the 'get-book' tool in the list_tools handler, defining its name, description, and input schema requiring a 'book_id' parameter.
    types.Tool(
        name="get-book",
        description="Get detailed information about a specific book",
        inputSchema={
            "type": "object",
            "properties": {
                "book_id": {
                    "type": "string",
                    "description": "The ID of the book to retrieve",
                },
            },
            "required": ["book_id"],
        },
    ),
  • The execution handler for the 'get-book' tool within the call_tool decorator. It retrieves the book data from the NeoDB API endpoint `/api/book/{book_id}` using the access token, formats it with format_book, and returns a TextContent response.
    elif name == "get-book":
        book_id = arguments.get("book_id")
        if not book_id:
            raise ValueError("Missing book_id parameter")
    
        async with httpx.AsyncClient() as client:
            book_data = await make_neodb_request(
                client,
                access_token,
                f"/api/book/{book_id}",
                api_base
            )
    
            if not book_data:
                return [types.TextContent(type="text", text=f"Failed to retrieve book with ID: {book_id}")]
    
            # Format detailed book information
            book_text = format_book(book_data)
            
            return [
                types.TextContent(
                    type="text",
                    text=book_text
                )
            ]
  • Helper function used by the 'get-book' handler to format the retrieved book data into a readable string with title, author, rating, and description.
    def format_book(book: dict) -> str:
        """Format a book into a concise string."""
        return (
            f"Title: {book.get('title', 'Unknown')}\n"
            f"Author: {book.get('author', 'Unknown')}\n"
            f"Rating: {book.get('rating', 'N/A')}\n"
            f"Description: {book.get('description', 'No description available')}\n"
            "---"
        )
  • Shared helper function used by the 'get-book' handler to make authenticated GET requests to the NeoDB API.
    async def make_neodb_request(client: httpx.AsyncClient, access_token: str, endpoint: str, api_base: str) -> dict[str, Any] | None:
        """
        Make an authenticated request to the NeoDB API
    
        Args:
            client (httpx.AsyncClient): The HTTP client to use
            access_token (str): The access token obtained from get_access_token
            endpoint (str): The API endpoint to call (e.g., '/api/me')
            api_base (str): The base URL for the NeoDB API
    
        Returns:
            dict: The API response
        """
        headers = {
            "Authorization": f"Bearer {access_token}",
            "Accept": "application/json",
        }
    
        url = f"{api_base}{endpoint}"
        
        try:
            response = await client.get(url, headers=headers, timeout=30.0)
            response.raise_for_status()
            return response.json()
        except httpx.HTTPStatusError as e:
            # Handle HTTP errors (4xx, 5xx status codes)
            return None, e.response.status_code
        except Exception as e:
            # Handle other errors (network issues, timeouts, etc)
            return None, 500  # Return 500 for internal errors
Behavior2/5

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

With no annotations provided, the description carries full burden but only states it retrieves information without disclosing behavioral traits. It doesn't mention whether this is a read-only operation, potential error conditions, authentication needs, or rate limits, which are critical for a tool with no structured safety hints.

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 a single, efficient sentence that directly states the tool's function without unnecessary words. It's front-loaded and wastes no space, making it easy to parse quickly.

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 no annotations and no output schema, the description is incomplete for a tool that retrieves data. It doesn't explain what 'detailed information' includes, potential return formats, or error handling, leaving significant gaps in understanding how to use the tool effectively.

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 the single parameter 'book_id' adequately. The description adds no additional meaning beyond implying retrieval of a 'specific book', which aligns with the schema but doesn't enhance parameter understanding, meeting the baseline for high coverage.

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 ('Get') and resource ('detailed information about a specific book'), making the purpose immediately understandable. However, it doesn't explicitly differentiate from sibling tools like 'search-books' (which likely searches multiple books) or 'get-user-info' (different resource), so it misses full sibling distinction.

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?

No guidance is provided on when to use this tool versus alternatives. The description implies it's for retrieving details of a specific book, but it doesn't mention prerequisites (e.g., needing a book_id) or contrast with 'search-books' for broader queries, leaving usage context unclear.

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/xytangme/neodb-mcp'

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