Skip to main content
Glama

guardian_longread

Filter and search The Guardian's Long Read articles by query, date range, and page size to access in-depth journalism efficiently.

Instructions

Search specifically for articles from The Long Read series

Input Schema

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

Implementation Reference

  • Core handler function that searches for Guardian Long Read articles using the specific series tag, validates and applies date/query filters, and returns formatted paginated results.
    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 guardian_longread handler.
    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(), });
  • Registers the guardian_longread tool by wrapping the handler function with client injection.
    guardian_longread: (args) => guardianLongread(client, args),
  • src/index.ts:141-172 (registration)
    MCP tool registration including name, description, and input schema advertised 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, }, }, }, },
  • Uses formatArticleResponse helper to format the search results (imported from utils/formatters.js). Note: full helper in separate file but referenced here.
    // For search results, default to truncated content for performance const formatOptions = { truncate: true, maxLength: 500 }; return formatArticleResponse(articles, pagination, formatOptions);

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