get_all_books
Retrieve a complete list of all books available in the bookstore inventory for browsing or management purposes.
Instructions
Get all books.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/bookstore_mcp/server.py:27-30 (handler)The core handler function for the 'get_all_books' MCP tool. Decorated with @mcp.tool() to register it with the FastMCP server. Executes by calling the load_books helper to return all books from the JSON data file.@mcp.tool() def get_all_books(): """Get all books.""" return load_books()
- src/bookstore_mcp/server.py:9-14 (helper)Supporting helper function used by get_all_books (and other tools) to load the books data from books.json, returning an empty list on errors.def load_books() -> list[dict]: try: with open(DATA_PATH, "r") as f: return json.load(f) except (FileNotFoundError, json.JSONDecodeError): return []
- src/bookstore_mcp/server.py:27-27 (registration)The @mcp.tool() decorator registers the get_all_books function as an MCP tool.@mcp.tool()