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 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
NameRequiredDescriptionDefault
nameYes

Implementation Reference

  • 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"],
    },
  • Registration of tools list including add_bookshelf via MCP ListToolsRequestHandler.
    server.setRequestHandler(ListToolsRequestSchema, async () => {
      return {
        tools: tools,
      };
  • 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"}
  • 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

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