Skip to main content
Glama

guardian_get_sections

Retrieve all available sections from The Guardian newspaper archives, enabling organized access to its extensive content since 1999.

Instructions

Get all available Guardian sections

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The main handler function that fetches Guardian sections using the client and formats them for output.
    export async function guardianGetSections(client: GuardianClient, args: any): Promise<string> { const response = await client.getSections(); const sections = response.response.results; return formatSectionsResponse(sections); }
  • Input schema definition for the tool in the MCP ListTools response (no parameters required).
    name: 'guardian_get_sections', description: 'Get all available Guardian sections', inputSchema: { type: 'object', properties: {}, }, },
  • Registration of the guardian_get_sections tool handler within the registerTools function that creates the tools map.
    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), }; }
  • Utility function used by the handler to format the sections list into a markdown response string.
    export function formatSectionsResponse(sections: GuardianSection[]): string { if (!sections || sections.length === 0) { return 'No sections found.'; } let result = 'Available Guardian sections:\n\n'; sections.forEach((section) => { result += `**${section.webTitle || 'Unknown'}**\n`; result += `ID: ${section.id || 'N/A'}\n`; result += `URL: ${section.webUrl || 'N/A'}\n\n`; }); return result; }

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