Skip to main content
Glama
hongfanmeng

Bookstore MCP Server

by hongfanmeng

get_book_by_id

Retrieve detailed information about a specific book using its unique identifier. This tool helps users find book details by ID for inventory lookup or purchase verification.

Instructions

Get book by ID.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
book_idYes

Implementation Reference

  • The main handler function for the 'get_book_by_id' tool. It is decorated with @mcp.tool() for registration and implements the logic to load books from JSON and return the matching book by ID.
    @mcp.tool() def get_book_by_id(book_id: int): """Get book by ID.""" books = load_books() return next((book for book in books if book["id"] == book_id), None)

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