Skip to main content
Glama
srgsanky

Personal Library MCP Server

by srgsanky

update_book_status

Update the owned or read status of a book in your personal library using its ISBN number to track your reading progress.

Instructions

Updates the owned and/or read status of a book by ISBN.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
isbnYes
ownedNo
readNo

Implementation Reference

  • The logic that updates the owned and/or read status of a book in the SQLite database.
    def update_book_status(isbn: str, owned: bool = None, read: bool = None) -> str:
        """Updates the owned and/or read status of a book by ISBN."""
        conn = get_db_connection()
        cursor = conn.cursor()
        
        updates = []
        params = []
        if owned is not None:
            updates.append("owned = ?")
            params.append(int(owned))
        if read is not None:
            updates.append("read = ?")
            params.append(int(read))
        
        if not updates:
            return "No updates provided."
            
        params.append(isbn)
        query = f"UPDATE books SET {', '.join(updates)} WHERE isbn = ?"
        
        cursor.execute(query, params)
        conn.commit()
        changes = conn.total_changes
        conn.close()
        
        if changes > 0:
            return f"Success: Updated status for book {isbn}."
        return f"Error: No book found with ISBN {isbn}."
  • server.py:86-86 (registration)
    MCP tool registration decorator for the update_book_status function.
    @mcp.tool()

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