Skip to main content
Glama
jbenton

guardian-mcp-server

by jbenton

guardian_browse_section

Browse recent articles from specific Guardian newspaper sections to access current news content from The Guardian archives.

Instructions

Browse recent articles from a specific Guardian section

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sectionYesSection ID (use guardian_get_sections to find valid IDs)
days_backNoHow many days back to search (default: 7)
page_sizeNoNumber of results, max 200 (default: 20)

Implementation Reference

  • The main handler function that parses input args using BrowseSectionParamsSchema, constructs Guardian API search parameters for a specific section and recent days, calls client.search(), and formats the article response with truncation.
    export async function guardianBrowseSection(client: GuardianClient, args: any): Promise<string> {
      const params = BrowseSectionParamsSchema.parse(args);
    
      const daysBack = params.days_back || 7;
      const fromDate = calculateDateFromDaysBack(daysBack);
    
      const searchParams: Record<string, any> = {
        section: params.section,
        'from-date': fromDate,
        'order-by': 'newest',
        'page-size': params.page_size || 20,
        'show-fields': 'headline,standfirst,byline,publication,firstPublicationDate'
      };
    
      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 for validating input parameters: requires 'section', optional 'days_back' (1-365), 'page_size' (1-200). Used in handler for runtime validation.
    export const BrowseSectionParamsSchema = z.object({
      section: z.string(),
      days_back: z.number().min(1).max(365).optional(),
      page_size: z.number().min(1).max(200).optional(),
    });
  • Registration function that maps tool names to handler wrappers, including 'guardian_browse_section' at line 27.
    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),
      };
    }
  • src/index.ts:202-226 (registration)
    MCP protocol tool registration in ListToolsResponse, defining name, description, and inputSchema matching the Zod schema.
      name: 'guardian_browse_section',
      description: 'Browse recent articles from a specific Guardian section',
      inputSchema: {
        type: 'object',
        properties: {
          section: {
            type: 'string',
            description: 'Section ID (use guardian_get_sections to find valid IDs)',
          },
          days_back: {
            type: 'integer',
            description: 'How many days back to search (default: 7)',
            minimum: 1,
            maximum: 365,
          },
          page_size: {
            type: 'integer',
            description: 'Number of results, max 200 (default: 20)',
            minimum: 1,
            maximum: 200,
          },
        },
        required: ['section'],
      },
    },
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. While 'browse recent articles' implies a read-only operation, it doesn't specify important behavioral aspects like whether results are paginated (beyond the page_size parameter), what format the articles are returned in, whether there are rate limits, or authentication requirements. The description is minimal and lacks the behavioral context needed for a tool with no annotation coverage.

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, clear sentence that efficiently communicates the core purpose without any wasted words. It's appropriately sized for a straightforward browsing tool and front-loads the essential information. Every word earns its place in this concise formulation.

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 (3 parameters, no output schema, no annotations), the description is minimally adequate but has clear gaps. It states what the tool does but lacks behavioral context, usage guidance, and output information. Without annotations or output schema, the agent must rely on the description alone, which doesn't provide complete context for effective tool selection and invocation.

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 schema description coverage is 100%, with all three parameters well-documented in the schema itself. The description adds no additional parameter semantics beyond what's already in the schema descriptions. According to the scoring rules, when schema coverage is high (>80%), the baseline is 3 even with no parameter information in the description, which applies here.

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 action ('browse recent articles') and resource ('from a specific Guardian section'), making the purpose immediately understandable. However, it doesn't explicitly distinguish this tool from similar siblings like 'guardian_top_stories_by_date' or 'guardian_content_timeline' which might also retrieve articles, though the 'section' focus provides some implicit differentiation.

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. With multiple sibling tools for retrieving Guardian content (e.g., guardian_search, guardian_top_stories_by_date, guardian_content_timeline), there's no indication of when this section-based browsing is preferred over other methods. The input schema mentions using guardian_get_sections to find valid IDs, but this is parameter documentation, not usage guidance.

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