Skip to main content
Glama
MissionSquad

@missionsquad/mcp-rss

Official

fetch_multiple_feeds

Batch fetch multiple RSS feeds simultaneously or sequentially with success/error status for each URL, enabling efficient monitoring and management of feed data.

Instructions

Batch fetch multiple RSS feeds with success/error status for each

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
parallelNoIf 'true', fetch feeds in parallel; otherwise, fetch sequentiallytrue
urlsYesArray of RSS feed URLs to fetch

Implementation Reference

  • The execute handler for 'fetch_multiple_feeds' that fetches multiple RSS feeds, supports parallel/sequential modes with concurrency limits, caching via feedCache, and returns aggregated results with per-feed status.
    execute: async (args, context) => {
      logger.info(
        `Fetching ${args.urls.length} feeds (parallel: ${args.parallel})`
      );
    
      const fetchFeed = async (url: string): Promise<MultiFeedResult> => {
        try {
          // Check cache first
          const cached = feedCache.get(url);
          if (cached) {
            return { url, success: true, data: cached };
          }
    
          const result = await rssReader.fetchFeed(url);
          feedCache.set(url, result);
    
          return { url, success: true, data: result };
        } catch (error: any) {
          logger.error(`Failed to fetch ${url}: ${error.message}`);
          return {
            url,
            success: false,
            error: {
              url,
              error: error.message,
              code: error.code,
              timestamp: Date.now(),
            },
          };
        }
      };
    
      let results: MultiFeedResult[];
    
      if (args.parallel === 'true') {
        // Parallel fetching with concurrency limit
        const chunks: string[][] = [];
        for (
          let i = 0;
          i < args.urls.length;
          i += config.rssMaxConcurrentFetches
        ) {
          chunks.push(args.urls.slice(i, i + config.rssMaxConcurrentFetches));
        }
    
        results = [];
        for (const chunk of chunks) {
          const chunkResults = await Promise.all(chunk.map(fetchFeed));
          results.push(...chunkResults);
        }
      } else {
        // Sequential fetching
        results = [];
        for (const url of args.urls) {
          results.push(await fetchFeed(url));
        }
      }
    
      const successCount = results.filter((r) => r.success).length;
      logger.info(
        `Fetched ${successCount}/${args.urls.length} feeds successfully`
      );
    
      return JSON.stringify(
        {
          total: args.urls.length,
          successful: successCount,
          failed: args.urls.length - successCount,
          results,
        },
        null,
        2
      );
    },
  • Zod schema defining input parameters for the fetch_multiple_feeds tool: urls array and optional parallel flag.
    const FetchMultipleFeedsSchema = z.object({
      urls: z.array(z.string()).describe("Array of RSS feed URLs to fetch"),
      parallel: z
        .string()
        .optional()
        .default("true")
        .describe(
          "If 'true', fetch feeds in parallel; otherwise, fetch sequentially"
        ),
    });
  • src/index.ts:88-167 (registration)
    Registration of the 'fetch_multiple_feeds' tool with FastMCP server using addTool, including name, description, parameters schema, and execute handler.
    server.addTool({
      name: "fetch_multiple_feeds",
      description:
        "Batch fetch multiple RSS feeds with success/error status for each",
      parameters: FetchMultipleFeedsSchema,
      execute: async (args, context) => {
        logger.info(
          `Fetching ${args.urls.length} feeds (parallel: ${args.parallel})`
        );
    
        const fetchFeed = async (url: string): Promise<MultiFeedResult> => {
          try {
            // Check cache first
            const cached = feedCache.get(url);
            if (cached) {
              return { url, success: true, data: cached };
            }
    
            const result = await rssReader.fetchFeed(url);
            feedCache.set(url, result);
    
            return { url, success: true, data: result };
          } catch (error: any) {
            logger.error(`Failed to fetch ${url}: ${error.message}`);
            return {
              url,
              success: false,
              error: {
                url,
                error: error.message,
                code: error.code,
                timestamp: Date.now(),
              },
            };
          }
        };
    
        let results: MultiFeedResult[];
    
        if (args.parallel === 'true') {
          // Parallel fetching with concurrency limit
          const chunks: string[][] = [];
          for (
            let i = 0;
            i < args.urls.length;
            i += config.rssMaxConcurrentFetches
          ) {
            chunks.push(args.urls.slice(i, i + config.rssMaxConcurrentFetches));
          }
    
          results = [];
          for (const chunk of chunks) {
            const chunkResults = await Promise.all(chunk.map(fetchFeed));
            results.push(...chunkResults);
          }
        } else {
          // Sequential fetching
          results = [];
          for (const url of args.urls) {
            results.push(await fetchFeed(url));
          }
        }
    
        const successCount = results.filter((r) => r.success).length;
        logger.info(
          `Fetched ${successCount}/${args.urls.length} feeds successfully`
        );
    
        return JSON.stringify(
          {
            total: args.urls.length,
            successful: successCount,
            failed: args.urls.length - successCount,
            results,
          },
          null,
          2
        );
      },
    });
  • TypeScript interface defining parameters for fetch_multiple_feeds, matching the Zod schema.
    export interface FetchMultipleFeedsParams {
      urls: string[];
      parallel?: 'true' | 'false';
    }

Tool Definition Quality

Score is being calculated. Check back soon.

Install Server

Other Tools

Related Tools

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/MissionSquad/mcp-rss'

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