Skip to main content
Glama
hongfanmeng

Bookstore MCP Server

by hongfanmeng

restock_book

Add inventory to books by specifying book ID and quantity. This tool manages stock levels for bookstore operations.

Instructions

Add stock to a book.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
book_idYes
quantityYes

Implementation Reference

  • The handler function for the 'restock_book' tool. It adds the specified quantity to the book's stock if the book exists and quantity > 0, then saves the updated books list. Returns success or error message.
    @mcp.tool()
    def restock_book(book_id: int, quantity: int):
        """Add stock to a book."""
        if quantity <= 0:
            return {"success": False, "error": "Quantity must be > 0"}
    
        books = load_books()
        book = next((b for b in books if b["id"] == book_id), None)
    
        if not book:
            return {"success": False, "error": f"Book {book_id} not found"}
    
        book["count"] += quantity
    
        if save_books(books):
            return {
                "success": True,
                "message": f"Restocked {quantity} of '{book['title']}'",
            }
        else:
            return {"success": False, "error": "Save failed"}
Behavior2/5

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

With no annotations, the description carries full burden but only states the action without behavioral details. It doesn't disclose if this requires admin permissions, whether it's idempotent, if it logs changes, or what happens on failure (e.g., invalid book_id). 'Add stock' implies a mutation, but safety, side effects, and response format are unspecified.

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 zero waste. It's front-loaded with the core action and resource, making it easy to parse quickly. No extraneous information or redundancy is present.

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 a mutation tool with 2 parameters, 0% schema coverage, no annotations, and no output schema, the description is incomplete. It lacks details on permissions, error handling, return values, and parameter meanings, leaving significant gaps for an AI agent to invoke it correctly in a real-world context.

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 but adds no parameter semantics. It doesn't explain what 'book_id' refers to (e.g., database ID, ISBN) or 'quantity' (e.g., units to add, must be positive). The schema provides titles and types, but meaning and constraints are undocumented in both schema and description.

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 stock to') and resource ('a book'), making the purpose understandable. It distinguishes from siblings like 'buy_book' (which likely reduces stock) and 'check_availability' (which queries stock), but doesn't explicitly differentiate from all siblings like inventory management tools that might exist.

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. It doesn't mention prerequisites (e.g., book must exist), when not to use it (e.g., for initial stock setup vs. restocking), or compare to siblings like 'buy_book' (which might handle sales transactions). The context is implied but not stated.

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