get-infoq-news
Fetch enterprise-level technical insights and developer updates from InfoQ, including software development, architecture design, cloud computing, and AI trends.
Instructions
获取 InfoQ 技术资讯,包含软件开发、架构设计、云计算、AI等企业级技术内容和前沿开发者动态
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| region | No | cn |
Implementation Reference
- src/tools/infoq.ts:23-31 (handler)Handler function for get-infoq-news tool: validates input using schema, fetches RSS items with getRssItems, omits description for 'cn' region, and returns the items.func: async (args) => { const { url, region } = infoqRequestSchema.parse(args); const resp = await getRssItems(url); // 中文版 description 没有实质内容 if (region === 'cn') { return resp.map((item) => omit(item, ['description'])); } return resp; },
- src/tools/infoq.ts:4-17 (schema)Zod input schema for the tool: defines optional 'region' parameter ('cn' or 'global' with default 'cn'), transforms to include the corresponding RSS URL.const infoqRequestSchema = z .object({ region: z.enum(['cn', 'global']).optional().default('cn'), }) .transform((data) => { const url = { cn: 'https://www.infoq.cn/feed', global: 'https://feed.infoq.com/', }[data.region]; return { ...data, url, }; });
- src/tools/infoq.ts:19-32 (registration)Tool registration via defineToolConfig: specifies name 'get-infoq-news', description, input schema, and inline handler function.export default defineToolConfig({ name: 'get-infoq-news', description: '获取 InfoQ 技术资讯,包含软件开发、架构设计、云计算、AI等企业级技术内容和前沿开发者动态', zodSchema: infoqRequestSchema, func: async (args) => { const { url, region } = infoqRequestSchema.parse(args); const resp = await getRssItems(url); // 中文版 description 没有实质内容 if (region === 'cn') { return resp.map((item) => omit(item, ['description'])); } return resp; }, });
- src/utils/rss.ts:10-32 (helper)Core helper function used by the tool to fetch RSS feed from URL, parse XML items, and structure them into title, description, category, author, publish_time, and 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, }; }); };