Skip to main content
Glama
libralm-ai

LibraLM MCP Server

Official
by libralm-ai

get_book_details

Retrieve comprehensive book information including summaries and chapter breakdowns by providing a book identifier. Access key insights from business, self-help, and educational books through this tool.

Instructions

Get detailed information about a specific book

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
book_idYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
tierNo
titleYes
authorNo
lengthNo
book_idYes
summaryNo
categoryNo
subtitleNo
has_summaryYes
release_dateNo
has_chapter_summariesYes
has_table_of_contentsYes

Implementation Reference

  • The handler function implementing the 'get_book_details' tool. It fetches detailed book information from the LibraLM API using the provided book_id and returns a structured BookInfo object.
    @mcp.tool()
    def get_book_details(book_id: str) -> BookInfo:
        """Get detailed information about a specific book"""
        try:
            data = _make_api_request(f"/books/{book_id}")
            return BookInfo(**data)
        except Exception as e:
            raise ValueError(f"Error getting details for book '{book_id}': {str(e)}")
  • Pydantic model defining the output schema (BookInfo) for the get_book_details tool.
    class BookInfo(BaseModel):
        """Book information structure"""
    
        book_id: str
        title: str
        author: Optional[str] = None
        category: Optional[str] = None
        subtitle: Optional[str] = None
        summary: Optional[str] = None
        length: Optional[str] = None
        release_date: Optional[str] = None
        tier: Optional[str] = None
        has_summary: bool
        has_chapter_summaries: bool
        has_table_of_contents: bool
  • Core helper function used by the tool to perform authenticated GET requests to the LibraLM API endpoints.
    def _make_api_request(endpoint: str) -> dict:
        """Make an authenticated request to the LibraLM API"""
        # Get API key and base URL from request context or environment
        api_key = get_api_key()
        base_url = get_api_base_url()
    
        headers = {"x-api-key": api_key, "Content-Type": "application/json"}
    
        url = f"{base_url}{endpoint}"
        response = requests.get(url, headers=headers)
    
        if response.status_code == 401:
            raise ValueError("Invalid API key. Please check your LibraLM API key.")
        elif response.status_code == 404:
            raise ValueError(f"Resource not found: {endpoint}")
        elif response.status_code != 200:
            raise ValueError(
                f"API request failed with status {response.status_code}: {response.text}"
            )
    
        # Handle wrapped response format from Lambda
        result = response.json()
        if isinstance(result, dict) and "data" in result:
            return result["data"]
        return result
  • FastMCP decorator that registers the get_book_details function as a tool.
    @mcp.tool()
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the tool retrieves information, implying a read-only operation, but doesn't specify aspects like authentication needs, rate limits, error handling, or what 'detailed information' entails beyond the schema. This leaves significant gaps in understanding the tool's behavior.

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 purpose without unnecessary words. It is appropriately sized and front-loaded, making it easy for an agent to parse quickly.

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

Completeness3/5

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

Given the tool's low complexity (one parameter) and the presence of an output schema, the description is somewhat complete but lacks depth. It doesn't clarify the scope of 'detailed information' or how it differs from sibling tools, which could hinder the agent's ability to use it effectively in context.

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?

The input schema has 0% description coverage, but the description adds minimal value by implying the parameter is for a 'specific book'. However, it doesn't explain the format or constraints of 'book_id' (e.g., whether it's an ISBN, internal ID, or something else). Since there's only one parameter, the baseline is 4, but the lack of semantic detail reduces it to 3.

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 tool's purpose with a specific verb ('Get') and resource ('detailed information about a specific book'), making it easy to understand what it does. However, it doesn't explicitly differentiate from sibling tools like 'get_book_summary' or 'list_books', which limits its effectiveness in helping the agent choose between alternatives.

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 like 'get_book_summary' or 'list_books'. It implies usage for detailed book information but lacks explicit context, exclusions, or prerequisites, leaving the agent to infer when this is the appropriate choice.

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/libralm-ai/libralm_mcp_server'

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