get_table_of_contents
Retrieve chapter descriptions and structure for any book in the LibraLM library to quickly understand content organization and key topics.
Instructions
Get the table of contents for a book with chapter descriptions
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| book_id | Yes |
Implementation Reference
- libralm_mcp_server.py:178-188 (handler)The main handler function for the 'get_table_of_contents' tool. It makes an API request to retrieve the table of contents for a given book_id and returns it as a string. Registered via @mcp.tool() decorator.@mcp.tool() def get_table_of_contents(book_id: str) -> str: """Get the table of contents for a book with chapter descriptions""" try: data = _make_api_request(f"/books/{book_id}/table_of_contents") return data.get("table_of_contents", "") except Exception as e: raise ValueError( f"Error getting table of contents for book '{book_id}': {str(e)}" )