remove_book
Delete a book from a specified bookshelf in your Micro.blog book 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:544-555 (handler)The handler logic for the 'remove_book' tool call in the MCP server switch statement. It parses arguments, invokes the MicroBooksClient.removeBook method, and formats the response as MCP content.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), }, ], }; }
- dxt-extension/server/index.js:360-378 (registration)Registration of the 'remove_book' tool in the tools list, including name, description, and input schema definition.name: "remove_book", description: "Remove a book from a bookshelf", 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"], }, },
- Core helper method in MicroBooksClient that performs the HTTP DELETE request to Micro.blog API to remove the book from the bookshelf.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" }; }
- micro_mcp_server/server.py:262-275 (handler)FastMCP tool handler and registration for 'remove_book'. Includes input parameters as schema, docstring description, calls client helper, returns JSON.@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
- micro_mcp_server/server.py:108-116 (helper)Core implementation in MicroBooksClient that sends DELETE request to the Micro.blog Books API endpoint to remove the specified book from the bookshelf.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"}