get_bookshelf_books
Retrieve books from a specific Micro.blog bookshelf by providing the bookshelf ID to access your organized book collection.
Instructions
Get books in a specific bookshelf.
Args: bookshelf_id: The ID of the bookshelf to get books from
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| bookshelf_id | Yes |
Implementation Reference
- micro_mcp_server/server.py:180-192 (handler)MCP tool handler for get_bookshelf_books: calls the MicroBooksClient method and returns JSON stringified result with docstring defining input schema.@mcp.tool() async def get_bookshelf_books(bookshelf_id: int) -> str: """Get books in a specific bookshelf. Args: bookshelf_id: The ID of the bookshelf to get books from """ try: result = await client.get_bookshelf_books(bookshelf_id) return json.dumps(result, indent=2) except Exception: logger.exception("Failed to get bookshelf books") raise
- micro_mcp_server/server.py:37-46 (helper)Helper method in MicroBooksClient that performs HTTP GET request to Micro.blog API to fetch books from a specific bookshelf.async def get_bookshelf_books(self, bookshelf_id: int) -> dict: """Get books in a specific bookshelf.""" async with httpx.AsyncClient() as client: response = await client.get( urljoin(BASE_URL, f"/books/bookshelves/{bookshelf_id}"), headers=self.headers, ) response.raise_for_status() return response.json()
- dxt-extension/server/index.js:479-490 (handler)Handler case in CallToolRequestSchema switch for get_bookshelf_books: extracts bookshelf_id, calls client method, returns formatted text content.case "get_bookshelf_books": { const { bookshelf_id } = args; const result = await client.getBookshelfBooks(bookshelf_id); return { content: [ { type: "text", text: JSON.stringify(result, null, 2), }, ], }; }
- Tool schema definition including name, description, and inputSchema specifying bookshelf_id as required positive integer.name: "get_bookshelf_books", description: "Get books in a specific bookshelf", inputSchema: { type: "object", properties: { bookshelf_id: { type: "integer", description: "The ID of the bookshelf to get books from", minimum: 1, }, }, required: ["bookshelf_id"], }, },
- dxt-extension/server/index.js:60-65 (helper)Helper method in MicroBooksClient that validates bookshelfId and makes HTTP request to fetch books from the bookshelf.async getBookshelfBooks(bookshelfId) { if (!Number.isInteger(bookshelfId) || bookshelfId <= 0) { throw new Error("Bookshelf ID must be a positive integer"); } return await this.makeRequest(`/books/bookshelves/${bookshelfId}`); }