Skip to main content
Glama
7robots

Micro.blog Books MCP Server

by 7robots

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

Implementation Reference

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

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