Skip to main content
Glama
hongfanmeng

Bookstore MCP Server

by hongfanmeng

check_availability

Verify book inventory status to confirm availability before purchase. Enter book ID and optional quantity to check stock levels.

Instructions

Check if book is available.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
book_idYes
quantityNo

Implementation Reference

  • The check_availability tool handler function. It loads books, finds the book by ID, and checks if the requested quantity is available, returning availability details.
    @mcp.tool()
    def check_availability(book_id: int, quantity: int = 1):
        """Check if book is available."""
        books = load_books()
        book = next((b for b in books if b["id"] == book_id), None)
    
        if not book:
            return {"available": False, "error": f"Book {book_id} not found"}
    
        return {
            "book_id": book_id,
            "title": book["title"],
            "available_count": book["count"],
            "available": book["count"] >= quantity,
        }
Behavior2/5

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

No annotations are provided, so the description carries full burden. It states the action but doesn't disclose behavioral traits such as whether this is a read-only operation, if it requires authentication, rate limits, or what the output looks like (e.g., boolean, details). This leaves significant gaps for an agent to understand how to invoke it correctly.

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 very concise with a single sentence, which is front-loaded and wastes no words. However, it's arguably too brief, bordering on under-specified, but within the scope of conciseness, it's efficient.

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 complexity (a check operation with 2 parameters), no annotations, no output schema, and 0% schema coverage, the description is incomplete. It doesn't provide enough context for an agent to fully understand how to use the tool, what to expect in return, or how it differs from siblings.

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

Parameters2/5

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

Schema description coverage is 0%, so the description must compensate. It mentions 'book' but doesn't explain the parameters 'book_id' or 'quantity' (e.g., what 'quantity' means in this context—number of copies needed?). This adds minimal meaning beyond the bare schema, failing to address the coverage gap.

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

Purpose3/5

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

The description 'Check if book is available' clearly states the verb ('check') and resource ('book'), but it's vague about what 'available' means (e.g., in stock, borrowable, reservable). It doesn't distinguish from siblings like 'get_books_in_stock' or 'get_book_by_id', which might provide overlapping information.

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 alternatives like 'get_books_in_stock' (which might list available books) or 'get_book_by_id' (which might include availability status). The description implies usage for checking availability but doesn't specify contexts or exclusions.

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/hongfanmeng/bookstore-mcp'

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