get_bookshelf_books
Retrieve books from a specific bookshelf in Micro.blog book collections using the bookshelf ID to organize and access your reading materials.
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:181-193 (handler)Primary MCP tool handler for 'get_bookshelf_books'. Decorated with @mcp.tool(), it calls the MicroBooksClient method and returns the result as a JSON string.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-45 (helper)Helper method in MicroBooksClient class that performs the actual HTTP request to Micro.blog API to fetch books from a 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()
- Explicit JSON schema definition for the 'get_bookshelf_books' tool input in the JavaScript MCP server implementation.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:479-490 (handler)Tool call handler case for 'get_bookshelf_books' in the JavaScript MCP server switch statement.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), }, ], }; }
- dxt-extension/server/index.js:60-64 (helper)Helper method in MicroBooksClient class (JS) that validates input and makes HTTP request to fetch bookshelf books.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}`);