Skip to main content
Glama

get_latest_news

Retrieve current New York Times news articles with options to filter by section, source, and pagination for targeted information access.

Instructions

Get the latest news items from the NYT news wire (real-time news feed).

Args: limit: Number of items to return (default: 20) offset: Pagination offset (default: 0) source: News source - "nyt" or "inyt" (default: "nyt") section: News section (default: "all"). e.g. "u.s." or "technology". Use the 'nyt://reference/sections' resource for available section names.

Returns: Formatted response with news_items array containing title, abstract, url, section, subsection, published_date, and byline

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNo
offsetNo
sourceNonyt
sectionNoall

Implementation Reference

  • The primary handler function for the 'get_latest_news' MCP tool. Registered via the @mcp.tool() decorator. Defines the tool's input parameters, documentation, and delegates execution to the helper function in tools.py.
    @mcp.tool() async def get_latest_news( limit: int = 20, offset: int = 0, source: tools.NewsSource = "nyt", section: str = "all", ) -> dict: """ Get the latest news items from the NYT news wire (real-time news feed). Args: limit: Number of items to return (default: 20) offset: Pagination offset (default: 0) source: News source - "nyt" or "inyt" (default: "nyt") section: News section (default: "all"). e.g. "u.s." or "technology". Use the 'nyt://reference/sections' resource for available section names. Returns: Formatted response with news_items array containing title, abstract, url, section, subsection, published_date, and byline """ return await tools.get_news_wire(limit, offset, source, section)
  • Type definition for 'NewsSource' parameter used in the get_latest_news tool handler for input validation (Literal['nyt', 'inyt', 'all']).
    type NewsSource = Literal["nyt", "inyt", "all"]
  • Core helper function implementing the NYT news wire API call, parameter handling, HTTP request via NytClient, and response formatting for the get_latest_news tool.
    async def get_news_wire( limit: int = 20, offset: int = 0, source: NewsSource = "nyt", section: str = "all", ) -> dict: """ Get the latest news items from the NYT news wire (real-time news feed). Args: limit: Number of items to return (default: 20) offset: Pagination offset (default: 0) source: News source - "nyt", "inyt", or "all" (default: "nyt") section: News section (e.g., "all", "world", "business") (default: "all"). To see the latest list of sections available, refer to the get_news_sections tool. Returns: Formatted response with news_items array containing title, abstract, url, section, subsection, published_date, and byline """ params = { "limit": limit, "offset": offset, } client = get_client() response = await client.make_nyt_request( f"news/v3/content/{source}/{section}.json", params ) return format_news_items_response(response)

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