change_book_cover
Update a book's cover image in your Micro.blog collection by providing a bookshelf ID, book ID, and new cover URL.
Instructions
Change the cover for a book.
Args: bookshelf_id: The ID of the bookshelf book_id: The ID of the book cover_url: URL to the new cover image
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| bookshelf_id | Yes | ||
| book_id | Yes | ||
| cover_url | Yes |
Implementation Reference
- dxt-extension/server/index.js:557-568 (handler)MCP tool call handler for 'change_book_cover': destructures arguments from request and calls the client helper method, returning JSON stringified result.case "change_book_cover": { const { bookshelf_id, book_id, cover_url } = args; const result = await client.changeBookCover(bookshelf_id, book_id, cover_url); return { content: [ { type: "text", text: JSON.stringify(result, null, 2), }, ], }; }
- MicroBooksClient helper method that validates inputs and makes POST request to Micro.blog API endpoint to update the book's cover image.async changeBookCover(bookshelfId, bookId, coverUrl) { 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"); } if (!coverUrl || typeof coverUrl !== 'string' || coverUrl.trim().length === 0) { throw new Error("Cover URL is required and must be a non-empty string"); } await this.makeRequest(`/books/bookshelves/${bookshelfId}/cover/${bookId}`, { method: "POST", body: new URLSearchParams({ cover_url: coverUrl.trim() }), }); return { success: true, message: "Book cover updated successfully" };
- Explicit JSON schema defining input parameters, types, descriptions, constraints, and required fields for the change_book_cover tool.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", minimum: 1, }, cover_url: { type: "string", description: "URL to the new cover image", minLength: 1, }, }, required: ["bookshelf_id", "book_id", "cover_url"],
- dxt-extension/server/index.js:380-402 (registration)Tool registration entry in the listTools response, specifying name, description, and input schema for MCP server.name: "change_book_cover", description: "Change the cover image for a book", 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", minimum: 1, }, cover_url: { type: "string", description: "URL to the new cover image", minLength: 1, }, }, required: ["bookshelf_id", "book_id", "cover_url"], },
- micro_mcp_server/server.py:277-291 (handler)FastMCP tool handler function for change_book_cover, decorated with @mcp.tool(), calls client helper and returns JSON result.@mcp.tool() async def change_book_cover(bookshelf_id: int, book_id: int, cover_url: str) -> str: """Change the cover for a book. Args: bookshelf_id: The ID of the bookshelf book_id: The ID of the book cover_url: URL to the new cover image """ try: result = await client.change_book_cover(bookshelf_id, book_id, cover_url) return json.dumps(result, indent=2) except Exception: logger.exception("Failed to change book cover") raise