Skip to main content
Glama
jbenton

guardian-mcp-server

by jbenton

guardian_longread

Search and retrieve in-depth articles from The Guardian's Long Read series by query, date range, and pagination to access detailed journalism.

Instructions

Search specifically for articles from The Long Read series

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryNoSearch terms within Long Read articles
from_dateNoStart date (YYYY-MM-DD format)
to_dateNoEnd date (YYYY-MM-DD format)
page_sizeNoResults per page, max 200 (default: 10)
pageNoPage number (default: 1)

Implementation Reference

  • Main handler function that implements the guardian_longread tool logic: validates input, constructs search params for Long Read tag, calls GuardianClient.search, formats response.
    export async function guardianLongread(client: GuardianClient, args: any): Promise<string> {
      const params = LongReadParamsSchema.parse(args);
    
      // Search for Long Read articles using the specific tag
      const searchParams: Record<string, any> = {
        tag: 'news/series/the-long-read',
        'page-size': params.page_size || 10,
        page: params.page || 1,
        'show-fields': 'headline,standfirst,body,byline,thumbnail,publication,firstPublicationDate'
      };
    
      if (params.query) {
        searchParams.q = params.query;
      }
      if (params.from_date) {
        const fromDate = validateDate(params.from_date);
        if (!fromDate) {
          throw new Error(`Invalid from_date format: ${params.from_date}. Use YYYY-MM-DD format.`);
        }
        searchParams['from-date'] = fromDate;
      }
      if (params.to_date) {
        const toDate = validateDate(params.to_date);
        if (!toDate) {
          throw new Error(`Invalid to_date format: ${params.to_date}. Use YYYY-MM-DD format.`);
        }
        searchParams['to-date'] = toDate;
      }
    
      const response = await client.search(searchParams);
      const articles = response.response.results;
      const pagination = response.response;
    
      // For search results, default to truncated content for performance
      const formatOptions = { truncate: true, maxLength: 500 };
      return formatArticleResponse(articles, pagination, formatOptions);
    }
  • Zod schema used for input validation in the handler: LongReadParamsSchema.
    export const LongReadParamsSchema = z.object({
      query: z.string().optional(),
      from_date: z.string().regex(/^\d{4}-\d{2}-\d{2}$/).optional(),
      to_date: z.string().regex(/^\d{4}-\d{2}-\d{2}$/).optional(),
      page_size: z.number().min(1).max(200).optional(),
      page: z.number().min(1).optional(),
    });
  • Registration of all tool handlers including guardian_longread in the registerTools function, which maps tool names to handler wrappers.
    export function registerTools(client: GuardianClient): Record<string, ToolHandler> {
      return {
        guardian_search: (args) => guardianSearch(client, args),
        guardian_get_article: (args) => guardianGetArticle(client, args),
        guardian_longread: (args) => guardianLongread(client, args),
        guardian_lookback: (args) => guardianLookback(client, args),
        guardian_browse_section: (args) => guardianBrowseSection(client, args),
        guardian_get_sections: (args) => guardianGetSections(client, args),
        guardian_search_tags: (args) => guardianSearchTags(client, args),
        guardian_search_by_length: (args) => guardianSearchByLength(client, args),
        guardian_search_by_author: (args) => guardianSearchByAuthor(client, args),
        guardian_find_related: (args) => guardianFindRelated(client, args),
        guardian_get_article_tags: (args) => guardianGetArticleTags(client, args),
        guardian_content_timeline: (args) => guardianContentTimeline(client, args),
        guardian_author_profile: (args) => guardianAuthorProfile(client, args),
        guardian_topic_trends: (args) => guardianTopicTrends(client, args),
        guardian_top_stories_by_date: (args) => guardianTopStoriesByDate(client, args),
        guardian_recommend_longreads: (args) => guardianRecommendLongreads(client, args),
      };
  • MCP protocol tool schema definition for guardian_longread provided in ListTools response.
      name: 'guardian_longread',
      description: 'Search specifically for articles from The Long Read series',
      inputSchema: {
        type: 'object',
        properties: {
          query: {
            type: 'string',
            description: 'Search terms within Long Read articles',
          },
          from_date: {
            type: 'string',
            description: 'Start date (YYYY-MM-DD format)',
          },
          to_date: {
            type: 'string',
            description: 'End date (YYYY-MM-DD format)',
          },
          page_size: {
            type: 'integer',
            description: 'Results per page, max 200 (default: 10)',
            minimum: 1,
            maximum: 200,
          },
          page: {
            type: 'integer',
            description: 'Page number (default: 1)',
            minimum: 1,
          },
        },
      },
    },
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 states the tool searches for articles but doesn't describe key behaviors like pagination handling (implied by 'page' and 'page_size' parameters), rate limits, authentication needs, or what the search results include (e.g., article metadata). For a search tool with 5 parameters and no annotations, this leaves significant gaps in understanding how it operates.

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 that front-loads the core purpose without unnecessary words. It directly states what the tool does ('Search specifically for articles from The Long Read series'), earning its place with zero waste. This is appropriately sized for the tool's complexity.

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 the tool has 5 parameters, no annotations, and no output schema, the description is incomplete. It lacks details on behavioral traits (e.g., search scope, result format), usage context compared to siblings, and output expectations. For a search tool with moderate complexity and no structured support, the description should provide more guidance to compensate for these gaps.

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

Parameters3/5

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

The input schema has 100% description coverage, with clear documentation for all 5 parameters (e.g., 'query' for search terms, date formats, pagination defaults). The description adds no additional parameter semantics beyond what's in the schema, such as explaining how 'query' interacts with the Long Read series or date range constraints. Baseline 3 is appropriate since the schema does the heavy lifting.

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: 'Search specifically for articles from The Long Read series.' It specifies the verb 'search' and the resource 'articles from The Long Read series,' making the intent unambiguous. However, it doesn't explicitly differentiate from sibling tools like 'guardian_recommend_longreads' or 'guardian_search,' which could provide similar functionality.

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?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention when to choose it over sibling tools such as 'guardian_search' (general search) or 'guardian_recommend_longreads' (recommendations), nor does it specify any prerequisites or exclusions. Usage is implied but not explicitly 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/jbenton/guardian-mcp-server'

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