search_feed_items
Search for specific content across multiple RSS feeds by querying titles, descriptions, or full content. Use this tool to filter and locate relevant feed items efficiently.
Instructions
Search for content across one or more RSS feeds
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| feeds | Yes | RSS feed URLs to search across | |
| query | Yes | Search query string | |
| searchIn | No | Which fields to search in | all |
Input Schema (JSON Schema)
{
"additionalProperties": false,
"properties": {
"feeds": {
"description": "RSS feed URLs to search across",
"items": {
"type": "string"
},
"type": "array"
},
"query": {
"description": "Search query string",
"type": "string"
},
"searchIn": {
"default": "all",
"description": "Which fields to search in",
"enum": [
"title",
"description",
"content",
"all"
],
"type": "string"
}
},
"required": [
"feeds",
"query"
],
"type": "object"
}
Implementation Reference
- src/index.ts:254-325 (handler)The execute handler function implementing the search_feed_items tool. It searches across specified RSS feeds for items matching the query in title, description, content, or all fields, using cache or fetching if needed.execute: async (args, context) => { logger.info(`Searching ${args.feeds.length} feeds for: "${args.query}"`); const searchResults: Array<{ feedUrl: string; feedTitle: string | null; item: FeedItem; matches: string[]; }> = []; // Fetch all feeds for (const feedUrl of args.feeds) { try { let feed: FeedResult | null = feedCache.get(feedUrl); if (!feed) { feed = await rssReader.fetchFeed(feedUrl); feedCache.set(feedUrl, feed); } // Search items const queryLower = args.query.toLowerCase(); for (const item of feed.items) { const matches: string[] = []; // Search in specified fields if (args.searchIn === "all" || args.searchIn === "title") { if (item.title?.toLowerCase().includes(queryLower)) { matches.push("title"); } } if (args.searchIn === "all" || args.searchIn === "description") { if (item.description?.toLowerCase().includes(queryLower)) { matches.push("description"); } } if (args.searchIn === "all" || args.searchIn === "content") { if (item.content?.toLowerCase().includes(queryLower)) { matches.push("content"); } } if (matches.length > 0) { searchResults.push({ feedUrl, feedTitle: feed.info.title, item, matches, }); } } } catch (error: any) { logger.error(`Failed to search feed ${feedUrl}: ${error.message}`); } } logger.info(`Found ${searchResults.length} matching items`); return JSON.stringify( { query: args.query, searchIn: args.searchIn, feedsSearched: args.feeds.length, totalMatches: searchResults.length, results: searchResults, }, null, 2 ); }, });
- src/index.ts:240-248 (schema)Zod schema defining input parameters for the search_feed_items tool: feeds (array of URLs), query (string), and optional searchIn field.const SearchFeedItemsSchema = z.object({ feeds: z.array(z.string()).describe("RSS feed URLs to search across"), query: z.string().describe("Search query string"), searchIn: z .enum(["title", "description", "content", "all"]) .optional() .default("all") .describe("Which fields to search in"), });
- src/index.ts:250-325 (registration)Registration of the search_feed_items tool via server.addTool, specifying name, description, parameters schema, and execute handler.server.addTool({ name: "search_feed_items", description: "Search for content across one or more RSS feeds", parameters: SearchFeedItemsSchema, execute: async (args, context) => { logger.info(`Searching ${args.feeds.length} feeds for: "${args.query}"`); const searchResults: Array<{ feedUrl: string; feedTitle: string | null; item: FeedItem; matches: string[]; }> = []; // Fetch all feeds for (const feedUrl of args.feeds) { try { let feed: FeedResult | null = feedCache.get(feedUrl); if (!feed) { feed = await rssReader.fetchFeed(feedUrl); feedCache.set(feedUrl, feed); } // Search items const queryLower = args.query.toLowerCase(); for (const item of feed.items) { const matches: string[] = []; // Search in specified fields if (args.searchIn === "all" || args.searchIn === "title") { if (item.title?.toLowerCase().includes(queryLower)) { matches.push("title"); } } if (args.searchIn === "all" || args.searchIn === "description") { if (item.description?.toLowerCase().includes(queryLower)) { matches.push("description"); } } if (args.searchIn === "all" || args.searchIn === "content") { if (item.content?.toLowerCase().includes(queryLower)) { matches.push("content"); } } if (matches.length > 0) { searchResults.push({ feedUrl, feedTitle: feed.info.title, item, matches, }); } } } catch (error: any) { logger.error(`Failed to search feed ${feedUrl}: ${error.message}`); } } logger.info(`Found ${searchResults.length} matching items`); return JSON.stringify( { query: args.query, searchIn: args.searchIn, feedsSearched: args.feeds.length, totalMatches: searchResults.length, results: searchResults, }, null, 2 ); }, });
- src/types.ts:95-99 (schema)TypeScript interface defining the parameter types for search_feed_items tool, matching the Zod schema.export interface SearchFeedItemsParams { feeds: string[]; query: string; searchIn?: 'title' | 'description' | 'content' | 'all'; }