Skip to main content
Glama
hongfanmeng

Bookstore MCP Server

by hongfanmeng

check_availability

Check if a specific book is available in the bookstore inventory by providing the book ID and optional quantity needed.

Instructions

Check if book is available.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
book_idYes
quantityNo

Implementation Reference

  • The core handler function for the 'check_availability' tool. It loads the books data, finds the book by ID, and checks if the requested quantity is available in stock. The @mcp.tool() decorator registers this function as an MCP tool.
    @mcp.tool() def check_availability(book_id: int, quantity: int = 1): """Check if book is available.""" books = load_books() book = next((b for b in books if b["id"] == book_id), None) if not book: return {"available": False, "error": f"Book {book_id} not found"} return { "book_id": book_id, "title": book["title"], "available_count": book["count"], "available": book["count"] >= quantity, }

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/hongfanmeng/bookstore-mcp'

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