remove_book
Remove a book from a specified bookshelf in your Micro.blog collection by providing the bookshelf and book IDs.
Instructions
Remove a book from a bookshelf.
Args: bookshelf_id: The ID of the bookshelf book_id: The ID of the book to remove
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| bookshelf_id | Yes | ||
| book_id | Yes |
Implementation Reference
- dxt-extension/server/index.js:144-157 (handler)The core handler function in the MicroBooksClient class that performs the HTTP DELETE request to remove a book from a specific bookshelf on Micro.blog.async removeBook(bookshelfId, bookId) { if (!Number.isInteger(bookshelfId) || bookshelfId <= 0) { throw new Error("Bookshelf ID must be a positive integer"); } if (!Number.isInteger(bookId) || bookId <= 0) { throw new Error("Book ID must be a positive integer"); } await this.makeRequest(`/books/bookshelves/${bookshelfId}/remove/${bookId}`, { method: "DELETE", }); return { success: true, message: "Book removed from bookshelf successfully" }; }
- The input schema definition for the 'remove_book' tool, specifying parameters bookshelf_id and book_id as required positive integers.inputSchema: { type: "object", properties: { bookshelf_id: { type: "integer", description: "The ID of the bookshelf", minimum: 1, }, book_id: { type: "integer", description: "The ID of the book to remove", minimum: 1, }, }, required: ["bookshelf_id", "book_id"], },
- dxt-extension/server/index.js:544-555 (registration)The switch case in the CallToolRequestSchema handler that registers and invokes the remove_book tool by calling the client handler.case "remove_book": { const { bookshelf_id, book_id } = args; const result = await client.removeBook(bookshelf_id, book_id); return { content: [ { type: "text", text: JSON.stringify(result, null, 2), }, ], }; }
- micro_mcp_server/server.py:108-116 (handler)The core handler in MicroBooksClient for Python implementation that sends the DELETE request to remove the book.async def remove_book(self, bookshelf_id: int, book_id: int) -> dict: """Remove a book from a bookshelf.""" async with httpx.AsyncClient() as client: response = await client.delete( urljoin(BASE_URL, f"/books/bookshelves/{bookshelf_id}/remove/{book_id}"), headers=self.headers, ) response.raise_for_status() return {"success": True, "message": "Book removed from bookshelf successfully"}
- micro_mcp_server/server.py:262-276 (registration)The FastMCP tool decorator and function that registers 'remove_book' and handles the tool call by delegating to the client.@mcp.tool() async def remove_book(bookshelf_id: int, book_id: int) -> str: """Remove a book from a bookshelf. Args: bookshelf_id: The ID of the bookshelf book_id: The ID of the book to remove """ try: result = await client.remove_book(bookshelf_id, book_id) return json.dumps(result, indent=2) except Exception: logger.exception("Failed to remove book") raise