add_bookshelf
Create a new bookshelf in your Micro.blog book collection to organize and categorize books for better management and tracking.
Instructions
Add a new bookshelf.
Args: name: The name of the new bookshelf
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes |
Implementation Reference
- dxt-extension/server/index.js:67-77 (handler)Core implementation of addBookshelf in MicroBooksClient: validates name, POSTs to Micro.blog /books/bookshelves endpoint, returns success message.async addBookshelf(name) { if (!name || typeof name !== 'string' || name.trim().length === 0) { throw new Error("Bookshelf name is required and must be a non-empty string"); } await this.makeRequest("/books/bookshelves", { method: "POST", body: new URLSearchParams({ name: name.trim() }), }); return { success: true, message: `Bookshelf '${name.trim()}' created successfully` };
- JSON schema definition for the add_bookshelf tool input: object with required 'name' string property.name: "add_bookshelf", description: "Create a new bookshelf", inputSchema: { type: "object", properties: { name: { type: "string", description: "The name of the new bookshelf", minLength: 1, }, }, required: ["name"], },
- dxt-extension/server/index.js:455-458 (registration)Registration of tools list including add_bookshelf via MCP ListToolsRequestHandler.server.setRequestHandler(ListToolsRequestSchema, async () => { return { tools: tools, };
- micro_mcp_server/server.py:47-56 (handler)Core handler in MicroBooksClient for adding bookshelf via HTTP POST to Micro.blog API.async def add_bookshelf(self, name: str) -> dict: """Add a new bookshelf.""" async with httpx.AsyncClient() as client: response = await client.post( urljoin(BASE_URL, "/books/bookshelves"), headers=self.headers, data={"name": name}, ) response.raise_for_status() return {"success": True, "message": f"Bookshelf '{name}' created successfully"}
- micro_mcp_server/server.py:195-206 (registration)FastMCP tool registration and wrapper handler for add_bookshelf, calls client method and returns JSON.async def add_bookshelf(name: str) -> str: """Add a new bookshelf. Args: name: The name of the new bookshelf """ try: result = await client.add_bookshelf(name) return json.dumps(result, indent=2) except Exception: logger.exception("Failed to add bookshelf") raise