Skip to main content
Glama
7robots

Micro.blog Books MCP Server

by 7robots

move_book

Move books between bookshelves in Micro.blog to organize your digital book collection. Specify book ID and target bookshelf ID to relocate items.

Instructions

Move a book to a different bookshelf.

Args: book_id: The ID of the book to move bookshelf_id: The ID of the target bookshelf

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
book_idYes
bookshelf_idYes

Implementation Reference

  • MCP tool handler and registration for 'move_book' using FastMCP @mcp.tool() decorator. Calls client.move_book() and returns JSON result.
    @mcp.tool() async def move_book(book_id: int, bookshelf_id: int) -> str: """Move a book to a different bookshelf. Args: book_id: The ID of the book to move bookshelf_id: The ID of the target bookshelf """ try: result = await client.move_book(book_id, bookshelf_id) return json.dumps(result, indent=2) except Exception: logger.exception("Failed to move book") raise
  • Core helper method in MicroBooksClient that performs the HTTP POST request to Micro.blog API to move a book to a different bookshelf.
    async def move_book(self, book_id: int, bookshelf_id: int) -> dict: """Move a book to a different bookshelf.""" async with httpx.AsyncClient() as client: response = await client.post( urljoin(BASE_URL, f"/books/bookshelves/{bookshelf_id}/assign"), headers=self.headers, data={"book_id": str(book_id)}, ) response.raise_for_status() return {"success": True, "message": f"Book moved to bookshelf {bookshelf_id} successfully"}
  • Explicit input schema definition for the 'move_book' tool, used in listTools response.
    { name: "move_book", description: "Move a book to a different bookshelf", inputSchema: { type: "object", properties: { book_id: { type: "integer", description: "The ID of the book to move", minimum: 1, }, bookshelf_id: { type: "integer", description: "The ID of the target bookshelf", minimum: 1, }, }, required: ["book_id", "bookshelf_id"], }, },
  • MCP tool handler for 'move_book' in the switch statement of callTool request handler. Dispatches to client.moveBook() and returns JSON content.
    case "move_book": { const { book_id, bookshelf_id } = args; const result = await client.moveBook(book_id, bookshelf_id); return { content: [ { type: "text", text: JSON.stringify(result, null, 2), }, ], }; }
  • Core helper method in MicroBooksClient class that validates inputs and makes HTTP POST to Micro.blog API to assign book to new bookshelf.
    async moveBook(bookId, bookshelfId) { if (!Number.isInteger(bookId) || bookId <= 0) { throw new Error("Book ID must be a positive integer"); } if (!Number.isInteger(bookshelfId) || bookshelfId <= 0) { throw new Error("Bookshelf ID must be a positive integer"); } await this.makeRequest(`/books/bookshelves/${bookshelfId}/assign`, { method: "POST", body: new URLSearchParams({ book_id: bookId.toString() }), }); return { success: true, message: `Book moved to bookshelf ${bookshelfId} 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