Skip to main content
Glama
7robots

Micro.blog Books MCP Server

by 7robots

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
NameRequiredDescriptionDefault
bookshelf_idYes
book_idYes

Implementation Reference

  • 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), }, ], }; }
  • 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" }; }
  • 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
  • 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"}

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/7robots/micro-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server