Skip to main content
Glama
srgsanky

Personal Library MCP Server

by srgsanky

list_books

Retrieve books from your personal library database. Filter to show only unread books using the unread_only parameter for focused reading management.

Instructions

Lists books in the library. Set unread_only=True to see only the books you haven't read yet.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
unread_onlyNo

Implementation Reference

  • server.py:52-66 (handler)
    The `list_books` tool handler, implemented in `server.py`, interacts with an SQLite database to return a JSON list of books, optionally filtered by read status.
    @mcp.tool()
    def list_books(unread_only: bool = False) -> str:
        """
        Lists books in the library. 
        Set unread_only=True to see only the books you haven't read yet.
        """
        conn = get_db_connection()
        cursor = conn.cursor()
        if unread_only:
            cursor.execute("SELECT isbn, name, owned, read FROM books WHERE read = 0")
        else:
            cursor.execute("SELECT isbn, name, owned, read FROM books")
        books = [dict(row) for row in cursor.fetchall()]
        conn.close()
        return json.dumps(books, indent=2)

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/srgsanky/mcp-demo'

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