Skip to main content
Glama
7robots

Micro.blog Books MCP Server

by 7robots

get_bookshelf_books

Retrieve books from a specific bookshelf in Micro.blog book collections using the bookshelf ID to organize and access your reading materials.

Instructions

Get books in a specific bookshelf.

Args: bookshelf_id: The ID of the bookshelf to get books from

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
bookshelf_idYes

Implementation Reference

  • Primary MCP tool handler for 'get_bookshelf_books'. Decorated with @mcp.tool(), it calls the MicroBooksClient method and returns the result as a JSON string.
    async def get_bookshelf_books(bookshelf_id: int) -> str: """Get books in a specific bookshelf. Args: bookshelf_id: The ID of the bookshelf to get books from """ try: result = await client.get_bookshelf_books(bookshelf_id) return json.dumps(result, indent=2) except Exception: logger.exception("Failed to get bookshelf books") raise
  • Helper method in MicroBooksClient class that performs the actual HTTP request to Micro.blog API to fetch books from a bookshelf.
    async def get_bookshelf_books(self, bookshelf_id: int) -> dict: """Get books in a specific bookshelf.""" async with httpx.AsyncClient() as client: response = await client.get( urljoin(BASE_URL, f"/books/bookshelves/{bookshelf_id}"), headers=self.headers, ) response.raise_for_status() return response.json()
  • Explicit JSON schema definition for the 'get_bookshelf_books' tool input in the JavaScript MCP server implementation.
    name: "get_bookshelf_books", description: "Get books in a specific bookshelf", inputSchema: { type: "object", properties: { bookshelf_id: { type: "integer", description: "The ID of the bookshelf to get books from", minimum: 1, }, }, required: ["bookshelf_id"], },
  • Tool call handler case for 'get_bookshelf_books' in the JavaScript MCP server switch statement.
    case "get_bookshelf_books": { const { bookshelf_id } = args; const result = await client.getBookshelfBooks(bookshelf_id); return { content: [ { type: "text", text: JSON.stringify(result, null, 2), }, ], }; }
  • Helper method in MicroBooksClient class (JS) that validates input and makes HTTP request to fetch bookshelf books.
    async getBookshelfBooks(bookshelfId) { if (!Number.isInteger(bookshelfId) || bookshelfId <= 0) { throw new Error("Bookshelf ID must be a positive integer"); } return await this.makeRequest(`/books/bookshelves/${bookshelfId}`);

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