Skip to main content
Glama

get_archive

Retrieve New York Times articles from a specific month and year. Access archived content by specifying date parameters to get the full API response.

Instructions

Get New York Times articles from a specific month and year archive.

Args: year: Year (default: current year) month: Month 1-12 (default: current month)

Returns: Full NYT archive API response (unformatted)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
yearNo
monthNo

Implementation Reference

  • Core handler function that executes the get_archive tool logic: determines year/month, fetches data from NYT archive API endpoint using shared NytClient, returns raw response.
    async def get_archive(year: int | None = None, month: int | None = None) -> dict:
        """
        Get New York Times articles from a specific month and year archive.
    
        Args:
            year: Year (default: current year)
            month: Month 1-12 (default: current month)
    
        Returns:
            Full NYT archive API response (unformatted)
        """
        now = datetime.now()
        year = year or now.year
        month = month or now.month
    
        client = get_client()
        response = await client.make_nyt_request(f"archive/v1/{year}/{month}.json", {})
    
        # Return raw response (no formatting for archive)
        return response
  • MCP registration of the get_archive tool using FastMCP @mcp.tool() decorator. Defines input schema via type hints/docstring and delegates execution to internal tools.get_archive.
    @mcp.tool()
    async def get_archive(year: int | None = None, month: int | None = None) -> dict:
        """
        Get New York Times articles from a specific month and year archive.
    
        Args:
            year: Year (default: current year)
            month: Month 1-12 (default: current month)
    
        Returns:
            Full NYT archive API response (unformatted)
        """
        return await tools.get_archive(year, month)

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