Skip to main content
Glama
libralm-ai

LibraLM MCP Server

Official
by libralm-ai

get_book_summary

Retrieve key insights and chapter breakdowns from books to understand core concepts without reading entire texts. Enter a book ID to access AI-generated summaries.

Instructions

Get the main summary for a book

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
book_idYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The handler function decorated with @mcp.tool() that implements the get_book_summary tool. It fetches the book summary by making an authenticated API request to the LibraLM API endpoint /books/{book_id}/summary.
    @mcp.tool()
    def get_book_summary(book_id: str) -> str:
        """Get the main summary for a book"""
        try:
            data = _make_api_request(f"/books/{book_id}/summary")
            return data.get("summary", "")
        except Exception as e:
            raise ValueError(f"Error getting summary for book '{book_id}': {str(e)}")
  • Supporting helper function used by the get_book_summary handler to perform authenticated API requests to the LibraLM service.
    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
  • The @mcp.tool() decorator registers the get_book_summary function as an MCP 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 it 'gets' a summary, implying a read operation, but doesn't mention any behavioral traits like permissions needed, rate limits, error handling, or what the output contains. This leaves significant gaps for an agent to understand how to use it effectively.

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, clear sentence with no wasted words, making it highly efficient and easy to parse. It's appropriately sized for a simple tool and front-loaded with the core action.

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 minimally adequate. However, with no annotations and incomplete behavioral context, it doesn't fully compensate for the lack of structured data, leaving gaps in usage understanding.

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

Parameters4/5

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

The description implies the parameter 'book_id' is used to identify a book for getting its summary, adding meaning beyond the schema's 0% coverage. Since there's only one parameter, the baseline is high, and the description adequately clarifies its purpose without needing detailed syntax.

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 ('main summary for a book'), making it easy to understand what it does. However, it doesn't explicitly distinguish this tool from its sibling 'get_book_details', which might also provide summary information, so it misses full differentiation.

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_details' or 'get_chapter_summary'. It lacks context about prerequisites, such as needing a book ID from 'list_books', or exclusions for when not to use it.

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