Skip to main content
Glama
hongfanmeng

Bookstore MCP Server

by hongfanmeng

check_availability

Verify book inventory status to confirm availability before purchase. Enter book ID and optional quantity to check stock levels.

Instructions

Check if book is available.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
book_idYes
quantityNo

Implementation Reference

  • The check_availability tool handler function. It loads books, finds the book by ID, and checks if the requested quantity is available, returning availability details.
    @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