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
| Name | Required | Description | Default |
|---|---|---|---|
| isbn | Yes | ||
| owned | No | ||
| read | No |
Implementation Reference
- server.py:87-114 (handler)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()