Skip to main content
Glama
7robots

Micro.blog Books MCP Server

by 7robots

add_book

Add a new book to a Micro.blog bookshelf by providing title, author, and bookshelf ID, with optional ISBN and cover image URL.

Instructions

Add a new book.

Args: title: The title of the book author: The author of the book bookshelf_id: The ID of the bookshelf to add the book to isbn: The ISBN of the book (optional) cover_url: URL to the book cover image (optional)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
titleYes
authorYes
bookshelf_idYes
isbnNo
cover_urlNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • FastMCP @mcp.tool() handler for the 'add_book' tool. Calls the client helper and returns JSON-formatted result.
    @mcp.tool()
    async def add_book(
        title: str,
        author: str,
        bookshelf_id: int,
        isbn: Optional[str] = None,
        cover_url: Optional[str] = None,
    ) -> str:
        """Add a new book.
        
        Args:
            title: The title of the book
            author: The author of the book
            bookshelf_id: The ID of the bookshelf to add the book to
            isbn: The ISBN of the book (optional)
            cover_url: URL to the book cover image (optional)
        """
        try:
            result = await client.add_book(title, author, bookshelf_id, isbn, cover_url)
            return json.dumps(result, indent=2)
        except Exception:
            logger.exception("Failed to add book")
            raise
  • MCP Server CallToolRequest handler switch case for 'add_book'. Destructures arguments, calls client.addBook, and returns MCP-formatted text content.
    case "add_book": {
      const { title, author, bookshelf_id, isbn, cover_url } = args;
      const result = await client.addBook(title, author, bookshelf_id, isbn, cover_url);
      return {
        content: [
          {
            type: "text",
            text: JSON.stringify(result, null, 2),
          },
        ],
      };
    }
  • Explicit JSON schema definition for 'add_book' tool inputs, used in ListTools response and validation.
    {
      name: "add_book",
      description: "Add a new book to a bookshelf",
      inputSchema: {
        type: "object",
        properties: {
          title: {
            type: "string",
            description: "The title of the book",
            minLength: 1,
          },
          author: {
            type: "string",
            description: "The author of the book",
            minLength: 1,
          },
          bookshelf_id: {
            type: "integer",
            description: "The ID of the bookshelf to add the book to",
            minimum: 1,
          },
          isbn: {
            type: "string",
            description: "The ISBN of the book (optional)",
          },
          cover_url: {
            type: "string",
            description: "URL to the book cover image (optional)",
          },
        },
        required: ["title", "author", "bookshelf_id"],
      },
    },
  • MicroBooksClient helper method implementing HTTP POST to Micro.blog /books endpoint to add book with optional ISBN and cover.
    async def add_book(
        self,
        title: str,
        author: str,
        bookshelf_id: int,
        isbn: Optional[str] = None,
        cover_url: Optional[str] = None,
    ) -> dict:
        """Add a new book."""
        data = {
            "title": title,
            "author": author,
            "bookshelf_id": str(bookshelf_id),
        }
        if isbn:
            data["isbn"] = isbn
        if cover_url:
            data["cover_url"] = cover_url
    
        async with httpx.AsyncClient() as client:
            response = await client.post(
                urljoin(BASE_URL, "/books"),
                headers=self.headers,
                data=data,
            )
            response.raise_for_status()
            return {"success": True, "message": f"Book '{title}' by {author} added successfully"}
  • MicroBooksClient.addBook helper with input validation, constructs POST data, calls makeRequest to Micro.blog API.
    async addBook(title, author, bookshelfId, isbn = null, coverUrl = null) {
      if (!title || typeof title !== 'string' || title.trim().length === 0) {
        throw new Error("Book title is required and must be a non-empty string");
      }
      if (!author || typeof author !== 'string' || author.trim().length === 0) {
        throw new Error("Book author is required and must be a non-empty string");
      }
      if (!Number.isInteger(bookshelfId) || bookshelfId <= 0) {
        throw new Error("Bookshelf ID must be a positive integer");
      }
    
      const data = {
        title: title.trim(),
        author: author.trim(),
        bookshelf_id: bookshelfId.toString(),
      };
    
      if (isbn && typeof isbn === 'string' && isbn.trim().length > 0) {
        data.isbn = isbn.trim();
      }
      if (coverUrl && typeof coverUrl === 'string' && coverUrl.trim().length > 0) {
        data.cover_url = coverUrl.trim();
      }
    
      await this.makeRequest("/books", {
        method: "POST",
        body: new URLSearchParams(data),
      });
    
      return { success: true, message: `Book '${title.trim()}' by ${author.trim()} added successfully` };
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden for behavioral disclosure. It states the action ('Add a new book') which implies a write operation, but doesn't mention permissions needed, whether duplicates are allowed, what happens on success/failure, or any rate limits. The description is minimal and lacks critical behavioral context for a mutation tool.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is appropriately concise with a clear purpose statement followed by parameter documentation. The Args section is well-structured and easy to parse. While efficient, it could be slightly more front-loaded with critical behavioral information before parameter details.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given this is a mutation tool with no annotations and 5 parameters, the description is incomplete. While it documents parameters adequately and an output schema exists (reducing need to describe return values), it lacks crucial behavioral context about permissions, error handling, and relationships to sibling tools. The presence of an output schema helps but doesn't compensate for missing mutation-specific guidance.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

With 0% schema description coverage, the description compensates well by listing all 5 parameters with brief explanations. It clearly identifies which are required vs optional, and provides basic semantic meaning for each parameter. However, it doesn't explain format constraints (e.g., ISBN format, URL validation) or relationships between parameters.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Add a new book') and resource ('book'), making the purpose immediately understandable. However, it doesn't differentiate this tool from sibling tools like 'move_book' or 'remove_book' beyond the basic verb, missing explicit distinction about when to use each.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like 'move_book' or 'change_book_cover'. There's no mention of prerequisites (e.g., bookshelf must exist), error conditions, or typical use cases, leaving the agent with insufficient context for tool selection.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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