get_all_books
Retrieve the complete inventory of books from the bookstore database to view available titles and manage stock.
Instructions
Get all books.
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "get_all_books"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/bookstore_mcp/server.py:27-30 (handler)The handler function for the get_all_books tool. Decorated with @mcp.tool() for registration and implementation. Returns the result of load_books().
@mcp.tool() def get_all_books(): """Get all books.""" return load_books() - src/bookstore_mcp/server.py:9-14 (helper)Helper function used by get_all_books to load the list of books from the JSON data file, handling errors gracefully.
def load_books() -> list[dict]: try: with open(DATA_PATH, "r") as f: return json.load(f) except (FileNotFoundError, json.JSONDecodeError): return []