Skip to main content
Glama

book

Fetch books from Zenn.dev by author username or topic name, with options to sort by date and paginate results.

Instructions

Fetch books from Zenn.dev

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
usernameNoUsername of the book author
topicnameNoTopic name of the book
orderNoOrder of the books. Choose from latest or oldest. Default: latest
pageNoPage number of the books. Default: 1
countNoNumber of books per page. Default: 48

Implementation Reference

  • The specific handler function for the 'book' tool. It parses the input arguments into a Book model instance and fetches the books data via fetch_books.
    async def handle_books(arguments: dict) -> dict:
        query = Book.from_arguments(arguments)
        return await fetch_books(query)
  • Pydantic model defining the input schema for the 'book' tool, including parsing from arguments, query param conversion, and the Tool definition with inputSchema.
    class Book(BaseModel):
        """Fetch books from Zenn.dev"""
    
        model_config = ConfigDict(
            validate_assignment=True,
            frozen=True,
            extra="forbid",
        )
    
        username: Optional[str] = Field(default=None, description="Username of the book author")
        topicname: Optional[str] = Field(default=None, description="Topic name of the book")
        order: Optional[Order] = Field(
            default=Order.LATEST,
            description=f"Order of the books. Choose from {Order.LATEST.value} or {Order.OLDEST.value}. Default: {Order.LATEST.value}",
        )
        page: Optional[int] = Field(default=1, description="Page number of the books. Default: 1")
        count: Optional[int] = Field(default=48, description="Number of books per page. Default: 48")
    
        @staticmethod
        def from_arguments(arguments: dict) -> "Book":
            return Book(
                username=arguments.get("username"),
                topicname=arguments.get("topicname"),
                order=Order.from_str(arguments.get("order", Order.LATEST.value)),
                page=arguments.get("page", 1),
                count=arguments.get("count", 48),
            )
    
        def to_query_param(self) -> dict:
            param = {}
            if self.username:
                param["username"] = self.username.lower()
            if self.topicname:
                param["topicname"] = self.topicname.lower()
            if self.order:
                param["order"] = self.order.value
            if self.page:
                param["page"] = self.page
            if self.count:
                param["count"] = self.count
            return param
    
        @staticmethod
        def tool() -> Tool:
            return Tool(
                name=ZennTool.BOOK.value,
                description="Fetch books from Zenn.dev",
                inputSchema={
                    "type": "object",
                    "properties": {
                        "username": {"type": "string", "description": Book.model_fields["username"].description},
                        "topicname": {"type": "string", "description": Book.model_fields["topicname"].description},
                        "order": {
                            "type": "string",
                            "description": Book.model_fields["order"].description,
                            "enum": [Order.LATEST.value, Order.OLDEST.value],
                        },
                        "page": {"type": "integer", "description": Book.model_fields["page"].description},
                        "count": {"type": "integer", "description": Book.model_fields["count"].description},
                    },
                    "required": [],
                },
            )
  • Registers the 'book' tool (via Book.tool()) with the MCP server.
    @server.list_tools()
    async def list_tools() -> list[Tool]:
        return [Article.tool(), Book.tool()]
  • Helper function that performs the HTTP request to fetch books from Zenn API using the query parameters from the Book model.
    async def fetch_books(query: Book) -> dict:
        return await request(URLResource.BOOKS, query.to_query_param())
  • Generic helper to make HTTP GET request to Zenn API endpoints and return JSON response.
    async def request(resource: URLResource, query: dict) -> dict:
        url = f"{BASE_URL}{resource.value}"
        async with httpx.AsyncClient() as client:
            response = await client.get(url, params=query)
            response.raise_for_status()
            return response.json()
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states 'Fetch books' but doesn't clarify if this is a read-only operation, requires authentication, has rate limits, or what the return format looks like. This leaves significant gaps in understanding the tool's behavior.

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

Conciseness5/5

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

The description is a single, efficient sentence with no wasted words. It's front-loaded with the core purpose and appropriately sized for a tool with clear parameters documented elsewhere.

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

Completeness2/5

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

Given the lack of annotations and output schema, the description is insufficient. It doesn't explain what 'fetching books' entails (e.g., returns a list, format, pagination details) or behavioral aspects like error handling, leaving the agent with incomplete context for a tool with 5 parameters.

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

Parameters3/5

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

The schema description coverage is 100%, with all parameters well-documented in the input schema. The description adds no additional parameter information beyond what's already in the schema, so it meets the baseline for adequate but not enhanced coverage.

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 verb ('Fetch') and resource ('books from Zenn.dev'), making the purpose immediately understandable. However, it doesn't differentiate from the sibling 'article' tool, which likely fetches articles rather than books from the same platform.

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?

No guidance is provided on when to use this tool versus the 'article' sibling tool or any alternatives. The description lacks context about use cases, prerequisites, or exclusions, leaving the agent with minimal direction.

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/shibuiwilliam/mcp-server-zenn'

If you have feedback or need assistance with the MCP directory API, please join our Discord server