get-theverge-news
Fetch insights on tech innovation, digital product reviews, internet trends, and tech company updates from The Verge to stay informed on emerging developments.
Instructions
获取 The Verge 新闻,包含科技创新、数码产品评测、互联网趋势及科技公司动态的英文科技资讯
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/theverge.ts:7-30 (handler)The handler function that fetches the RSS feed from The Verge, validates the entries, processes links to canonical form, and maps to output format with title, description, publish_time, and link.func: async () => { const rss = await getRss('https://www.theverge.com/rss/index.xml'); if (!Array.isArray(rss.feed.entry)) { throw new Error('获取 The Verge 新闻失败'); } return (rss.feed.entry as any[]).map((item) => { let link = item.link; if (!link && item.id) { link = item.id; } const url = new URL(link); if (url.searchParams.has('p')) { url.pathname = url.searchParams.get('p') as string; url.search = ''; link = url.toString(); } return { title: item.title, description: item.summary, publish_time: item.published, link, }; }); },
- src/tools/theverge.ts:4-31 (registration)The tool registration using defineToolConfig, exporting the configuration with name, description, and reference to the handler function. Loaded dynamically by the MCP server.export default defineToolConfig({ name: 'get-theverge-news', description: '获取 The Verge 新闻,包含科技创新、数码产品评测、互联网趋势及科技公司动态的英文科技资讯', func: async () => { const rss = await getRss('https://www.theverge.com/rss/index.xml'); if (!Array.isArray(rss.feed.entry)) { throw new Error('获取 The Verge 新闻失败'); } return (rss.feed.entry as any[]).map((item) => { let link = item.link; if (!link && item.id) { link = item.id; } const url = new URL(link); if (url.searchParams.has('p')) { url.pathname = url.searchParams.get('p') as string; url.search = ''; link = url.toString(); } return { title: item.title, description: item.summary, publish_time: item.published, link, }; }); }, });
- src/utils/rss.ts:4-8 (helper)Shared helper function to fetch RSS feed via HTTP and parse it using fast-xml-parser.export const getRss = async (url: string) => { const resp = await http.get(url); const parser = new XMLParser(); return parser.parse(resp.data); };