monitor_feed_updates
Track new items in an RSS feed by specifying a URL and checking updates since a specific time or the last fetch, ensuring timely content monitoring.
Instructions
Check for new items in a feed since a specific time or last check
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| since | Yes | Time reference for checking updates | |
| url | Yes | The RSS feed URL to monitor |
Implementation Reference
- src/index.ts:185-236 (handler)The execute handler function that fetches the RSS feed, computes the 'since' timestamp, filters for new items based on publish/update dates, updates the cache, and returns a structured response with new items and metadata.execute: async (args, context) => { logger.info(`Monitoring updates for: ${args.url} since ${args.since}`); // Get current feed state const currentFeed = await rssReader.fetchFeed(args.url); let sinceTimestamp: number; if (args.since === "last") { // Get last fetch time from cache const cached = feedCache.get(args.url); if (cached) { sinceTimestamp = cached.fetchedAt; } else { // If no cache, return all items as new sinceTimestamp = 0; } } else { sinceTimestamp = args.since; } // Filter items newer than timestamp const newItems = currentFeed.items.filter((item) => { const itemTime = item.published || item.updated || 0; return itemTime > sinceTimestamp; }); // Update cache feedCache.set(args.url, currentFeed); logger.info( `Found ${newItems.length} new items since ${new Date( sinceTimestamp ).toISOString()}` ); return JSON.stringify( { feedUrl: args.url, feedTitle: currentFeed.info.title, since: sinceTimestamp, sinceISO: new Date(sinceTimestamp).toISOString(), checkedAt: currentFeed.fetchedAt, checkedAtISO: new Date(currentFeed.fetchedAt).toISOString(), newItemsCount: newItems.length, totalItemsCount: currentFeed.items.length, newItems, }, null, 2 ); },
- src/index.ts:170-178 (schema)Zod schema defining input parameters: url (string) and since (number timestamp or 'last').const MonitorFeedUpdatesSchema = z.object({ url: z.string().describe("The RSS feed URL to monitor"), since: z .union([ z.number().describe("Timestamp in milliseconds to check updates since"), z.literal("last").describe("Check updates since last fetch"), ]) .describe("Time reference for checking updates"), });
- src/index.ts:180-237 (registration)Registers the 'monitor_feed_updates' tool with the FastMCP server, specifying name, description, parameter schema, and execute handler.server.addTool({ name: "monitor_feed_updates", description: "Check for new items in a feed since a specific time or last check", parameters: MonitorFeedUpdatesSchema, execute: async (args, context) => { logger.info(`Monitoring updates for: ${args.url} since ${args.since}`); // Get current feed state const currentFeed = await rssReader.fetchFeed(args.url); let sinceTimestamp: number; if (args.since === "last") { // Get last fetch time from cache const cached = feedCache.get(args.url); if (cached) { sinceTimestamp = cached.fetchedAt; } else { // If no cache, return all items as new sinceTimestamp = 0; } } else { sinceTimestamp = args.since; } // Filter items newer than timestamp const newItems = currentFeed.items.filter((item) => { const itemTime = item.published || item.updated || 0; return itemTime > sinceTimestamp; }); // Update cache feedCache.set(args.url, currentFeed); logger.info( `Found ${newItems.length} new items since ${new Date( sinceTimestamp ).toISOString()}` ); return JSON.stringify( { feedUrl: args.url, feedTitle: currentFeed.info.title, since: sinceTimestamp, sinceISO: new Date(sinceTimestamp).toISOString(), checkedAt: currentFeed.fetchedAt, checkedAtISO: new Date(currentFeed.fetchedAt).toISOString(), newItemsCount: newItems.length, totalItemsCount: currentFeed.items.length, newItems, }, null, 2 ); }, });
- src/types.ts:90-93 (schema)TypeScript interface defining the tool's input parameters, matching the Zod schema.export interface MonitorFeedUpdatesParams { url: string; since: number | 'last'; }