Skip to main content
Glama

get_bestseller_list

Retrieve New York Times bestseller lists for specific categories like fiction and nonfiction to track popular books.

Instructions

Get New York Times bestseller lists.

Args: list: List name (e.g., "hardcover-fiction", "hardcover-nonfiction", "paperback-nonfiction") Default is "hardcover-fiction". Use the 'nyt://reference/bestseller-lists' resource for available list names. offset: Pagination offset (default: 0)

Returns: Full NYT Books API response (unformatted)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
listNohardcover-fiction
offsetNo

Implementation Reference

  • Core handler function implementing the tool logic by making an HTTP request to the NYT Books API endpoint.
    async def get_bestseller_list(list: str = "hardcover-fiction", offset: int = 0) -> dict:
        """
        Get New York Times bestseller lists.
    
        Args:
            list: List name (e.g., "hardcover-fiction", "hardcover-nonfiction", "paperback-nonfiction")
                  Default is "hardcover-fiction"
            offset: Pagination offset (default: 0)
    
        Returns:
            Full NYT Books API response (unformatted)
        """
        params = {"offset": offset}
    
        client = get_client()
        response = await client.make_nyt_request(
            f"books/v3/lists/current/{list}.json",
            params,
        )
    
        # Return raw response (no formatting for books)
        return response
  • MCP tool registration with @mcp.tool() decorator. Defines input schema via type hints and delegates execution to the core handler.
    @mcp.tool()
    async def get_bestseller_list(list: str = "hardcover-fiction", offset: int = 0) -> dict:
        """
        Get New York Times bestseller lists.
    
        Args:
            list: List name (e.g., "hardcover-fiction", "hardcover-nonfiction", "paperback-nonfiction")
                  Default is "hardcover-fiction". Use the 'nyt://reference/bestseller-lists' resource
                  for available list names.
            offset: Pagination offset (default: 0)
    
        Returns:
            Full NYT Books API response (unformatted)
        """
        return await tools.get_bestseller_list(list, offset)
  • MCP resource registration providing reference data for valid 'list' parameter values used by the tool.
    @mcp.resource("nyt://reference/bestseller-lists")
    def list_bestseller_lists() -> dict:
        """Available bestseller list names for the get_bestseller_list tool."""
        return resources.get_bestseller_lists()
  • Supporting function providing a static list of valid bestseller list names for the tool's input validation and reference.
    def get_bestseller_lists() -> dict:
        """
        Get available bestseller list names for the books endpoint.
    
        Returns:
            Dict with lists array
        """
        return {
            "lists": [
                "combined-print-and-e-book-fiction",
                "combined-print-and-e-book-nonfiction",
                "hardcover-fiction",
                "hardcover-nonfiction",
                "trade-fiction-paperback",
                "paperback-nonfiction",
                "advice-how-to-and-miscellaneous",
                "childrens-middle-grade-hardcover",
                "picture-books",
                "series-books",
                "young-adult-hardcover",
                "audio-fiction",
                "audio-nonfiction",
                "business-books",
                "graphic-books-and-manga",
                "mass-market-monthly",
                "middle-grade-paperback-monthly",
                "young-adult-paperback-monthly",
            ],
            "description": "Available bestseller list names for the get_bestseller_list tool",
            "note": "List names use hyphens instead of spaces. Visit developer.nytimes.com for the complete list.",
        }
Behavior2/5

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

No annotations are provided, so the description carries the full burden. It mentions pagination via 'offset' and references an external resource for list names, but lacks details on rate limits, authentication needs, error handling, or the structure of the 'unformatted' response. For a tool with no annotation coverage, this leaves significant behavioral gaps.

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 well-structured with a clear purpose statement followed by Args and Returns sections. It uses bullet-like formatting efficiently, though the 'Returns' section could be more descriptive. Every sentence adds value without redundancy.

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 no annotations and no output schema, the description provides basic purpose and parameter info but lacks details on response format, error cases, or operational constraints. It is minimally viable for a simple retrieval tool but incomplete for robust agent use, as it doesn't fully address the complexity implied by external references and pagination.

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?

Schema description coverage is 0%, so the description must compensate. It adds meaningful context for both parameters: 'list' is explained with examples and a reference for available names, and 'offset' is clarified as a pagination offset with default values. This goes beyond the basic schema, though it could detail format constraints more explicitly.

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

Purpose5/5

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

The description clearly states the tool's purpose with a specific verb ('Get') and resource ('New York Times bestseller lists'), distinguishing it from sibling tools like get_archive or get_latest_news. It precisely identifies what data is retrieved without ambiguity.

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

Usage Guidelines3/5

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

The description implies usage by specifying the type of data retrieved (bestseller lists), but does not explicitly state when to use this tool versus alternatives like get_most_popular or search_articles. No guidance is provided on prerequisites or exclusions, leaving context somewhat open-ended.

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/jeffmm/nytimes-mcp'

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