Skip to main content
Glama
7robots

Micro.blog Books MCP Server

by 7robots

add_bookshelf

Create a new bookshelf in your Micro.blog book collection to organize books by categories, genres, or reading goals.

Instructions

Add a new bookshelf.

Args: name: The name of the new bookshelf

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYes

Implementation Reference

  • Core handler in MicroBooksClient that validates the bookshelf name and makes a POST request to the Micro.blog API to create a new bookshelf.
    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` };
  • Input schema for the add_bookshelf tool, defining the required 'name' parameter as a non-empty string.
    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"], },
  • Tool call dispatcher case that handles 'add_bookshelf' requests by calling the client handler and formatting the response.
    case "add_bookshelf": { const { name } = args; const result = await client.addBookshelf(name); return { content: [ { type: "text", text: JSON.stringify(result, null, 2), }, ], };
  • Helper method in MicroBooksClient that performs the API POST to create a bookshelf (used by tool handler).
    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"}
  • MCP tool handler and registration via @mcp.tool() decorator; calls client method and returns JSON response.
    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

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