Skip to main content
Glama

get_most_popular

Retrieve New York Times articles by popularity type (viewed, shared, or emailed) and time period (1, 7, or 30 days) to analyze trending content.

Instructions

Get the most popular New York Times articles.

Args: type: Type of popularity - "viewed", "shared", or "emailed" (default: "viewed") time_period: Time period in days - "1", "7", or "30" (default: "1") Use the 'nyt://reference/popular-types' resource for available options.

Returns: Formatted response with articles array containing title, abstract, url, and published_date

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
popularity_typeNoviewed
time_periodNo1

Implementation Reference

  • Core handler function implementing the logic to fetch most popular NYT articles from the API endpoint and format the response using format_popular_response.
    async def get_most_popular(
        popularity_type: PopularityType = "viewed",
        time_period: PopularityPeriod = "1",
    ) -> dict:
        """
        Get the most popular New York Times articles.
    
        Args:
            popularity_type: Type of popularity - "viewed", "shared", or "emailed" (default: "viewed")
            time_period: Time period in days - "1", "7", or "30" (default: "1")
    
        Returns:
            Formatted response with articles array containing title, abstract, url, and published_date
        """
        client = get_client()
        response = await client.make_nyt_request(
            f"mostpopular/v2/{popularity_type}/{time_period}.json",
            {},
        )
    
        return format_popular_response(response)
  • Registers the get_most_popular tool with the FastMCP server using the @mcp.tool() decorator. The function signature and docstring define the tool's input schema. Delegates to the implementation in tools.py.
    @mcp.tool()
    async def get_most_popular(
        popularity_type: tools.PopularityType = "viewed",
        time_period: tools.PopularityPeriod = "1",
    ) -> dict:
        """
        Get the most popular New York Times articles.
    
        Args:
            type: Type of popularity - "viewed", "shared", or "emailed" (default: "viewed")
            time_period: Time period in days - "1", "7", or "30" (default: "1")
                  Use the 'nyt://reference/popular-types' resource for available options.
    
        Returns:
            Formatted response with articles array containing title, abstract, url, and published_date
        """
        return await tools.get_most_popular(popularity_type, time_period)
  • Type aliases using Literal for input validation of popularity_type and time_period parameters.
    type PopularityType = Literal["viewed", "shared", "emailed"]
    type PopularityPeriod = Literal["1", "7", "30"]
  • Helper utility to format the raw API response into a structured output with articles list containing key fields.
    def format_popular_response(response: dict[str, Any]) -> dict[str, Any]:
        """
        Format most popular response to extract essential fields.
    
        Args:
            response: Raw NYT most popular API response
    
        Returns:
            Formatted response with articles array and num_results
        """
        if "results" in response:
            return {
                "articles": [
                    {
                        "title": article.get("title", ""),
                        "abstract": article.get("abstract", ""),
                        "url": article.get("url", ""),
                        "published_date": article.get("published_date", ""),
                    }
                    for article in response["results"]
                ],
                "num_results": len(response["results"]),
            }
        return response
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 of behavioral disclosure. It mentions the return format but doesn't cover important aspects like rate limits, authentication needs, error handling, or whether this is a read-only operation. For a tool with zero 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 clear sections for Args and Returns, making it easy to parse. It's appropriately sized with no redundant information, though it could be slightly more concise by integrating the resource reference more seamlessly. Every sentence adds value.

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 the tool's moderate complexity (2 parameters, no output schema, no annotations), the description is partially complete. It covers parameters well and specifies the return format, but lacks behavioral details like error handling or rate limits. Without annotations or output schema, it should do more to be fully comprehensive.

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

Parameters5/5

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

The description adds substantial meaning beyond the input schema, which has 0% description coverage. It explains the semantics of both parameters: 'type' as popularity type with options and default, and 'time_period' as time period in days with options and default. This fully compensates for the lack of schema descriptions, providing clear parameter context.

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 tool's purpose: 'Get the most popular New York Times articles.' It specifies the resource (NYT articles) and the verb (get), but it doesn't explicitly differentiate from siblings like 'get_latest_news' or 'search_articles' in terms of popularity vs. recency or search criteria. The purpose is clear but lacks sibling differentiation.

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 popularity and time period, but it doesn't explicitly state when to use this tool versus alternatives like 'get_latest_news' or 'search_articles'. There's no guidance on prerequisites or exclusions, leaving usage context somewhat implied rather than clearly defined.

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