Skip to main content
Glama
7robots

Micro.blog Books MCP Server

by 7robots

move_book

Relocate a book to a different bookshelf in your Micro.blog collection by specifying the book ID and target bookshelf ID.

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

  • Handler function for the 'move_book' MCP tool. Registers the tool via @mcp.tool() decorator and implements the logic by calling the MicroBooksClient.move_book method and returning 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
  • Helper method in MicroBooksClient that performs the actual HTTP POST request to Micro.blog API to assign/move a book to a 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"}
  • Handler function for the 'move_book' MCP tool in Modal deployment (identical logic).
    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:
  • Handler function for the 'move_book' MCP tool in Python DXT extension version (identical logic).
    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
  • Helper method in MicroBooksClient (identical across implementations) that executes the core API call to move the book.
    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"}

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