Skip to main content
Glama
baranwang

Trends Hub

get-bbc-news

Fetch BBC news articles across categories like world, UK, business, politics, health, education, technology, and entertainment to access global news coverage.

Instructions

获取 BBC 新闻,提供全球新闻、英国新闻、商业、政治、健康、教育、科技、娱乐等资讯

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
categoryNo
editionNo版本,仅对 `category` 为空有效

Implementation Reference

  • src/tools/bbc.ts:47-55 (registration)
    Tool registration defining name, description, schema, and thin handler function that delegates to getRssItems after schema parsing.
    export default defineToolConfig({ name: 'get-bbc-news', description: '获取 BBC 新闻,提供全球新闻、英国新闻、商业、政治、健康、教育、科技、娱乐等资讯', zodSchema: bbcRequestSchema, func: async (args) => { const { url } = bbcRequestSchema.parse(args); return getRssItems(url); }, });
  • Zod schema for tool input: category (news section) and edition, with transform to construct the BBC RSS feed URL.
    const bbcRequestSchema = z .object({ category: z .union([ z.literal('').describe('热门新闻'), z.literal('world').describe('国际'), z.literal('uk').describe('英国'), z.literal('business').describe('商业'), z.literal('politics').describe('政治'), z.literal('health').describe('健康'), z.literal('education').describe('教育'), z.literal('science_and_environment').describe('科学与环境'), z.literal('technology').describe('科技'), z.literal('entertainment_and_arts').describe('娱乐与艺术'), ]) .optional() .default(''), edition: z .union([ z.literal(''), z.literal('uk').describe('UK'), z.literal('us').describe('US & Canada'), z.literal('int').describe('Rest of the world'), ]) .optional() .default('') .describe('版本,仅对 `category` 为空有效'), }) .transform((values) => { let url = 'https://feeds.bbci.co.uk/news/'; if (values.category) { url += `${values.category}/`; } url += 'rss.xml'; if (values.edition) { url += `?edition=${values.edition}`; } return { ...values, url, }; });
  • Core utility function that fetches and parses RSS feed XML, extracting structured news items (title, description, category, author, pub date, link).
    export const getRssItems = async (url: string) => { const data = await getRss(url); if (!Array.isArray(data.rss?.channel?.item)) { return []; } return (data.rss.channel.item as any[]).map((item) => { let category = ''; if (typeof item.category === 'string') { category = item.category; } if (Array.isArray(item.category)) { category = item.category.join(', '); } return { title: item.title, description: item.description, category, author: item.author || item['dc:creator'], publish_time: item.pubDate, link: item.link, }; }); };

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/baranwang/mcp-trends-hub'

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