Skip to main content
Glama
CaptainCrouton89

Claude Parallel Tasks MCP Server

run_parallel_claude_tasks

Execute multiple Claude AI prompts simultaneously with file context support and output redirection to files for batch processing.

Instructions

Runs multiple Claude prompts in parallel, optionally with file contexts, redirecting output to files.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queriesYesA list of query objects to run with Claude in parallel

Implementation Reference

  • The handler function for the run_parallel_claude_tasks tool. It processes a list of queries in parallel, executes Claude prompts via shell commands using execAsync, handles file contexts, generates output files, and returns a status report.
      async ({ queries }) => {
        const taskPromises = queries.map(async (query, i) => {
          const { queryText, contextFilePaths } = query;
          // Escape double quotes in the query to prevent command injection issues
          const escapedQueryText = queryText.replace(/"/g, '\\"');
          const outputFileName = `claude_task_${i}_${Date.now()}.md`;
    
          let fileContextString = "";
          if (contextFilePaths && contextFilePaths.length > 0) {
            // Ensure file paths are properly escaped if they contain spaces or special characters
            // For simplicity, assuming paths don't need complex escaping beyond being quoted if necessary.
            // However, for robust handling, each path might need individual shell argument escaping.
            fileContextString =
              contextFilePaths.map((fp) => `"${fp}"`).join(" ") + " "; // Add a space after the files
          }
    
          // Use environment variable for API key
          const apiKey = process.env.ANTHROPIC_API_KEY;
          if (!apiKey) {
            throw new Error("ANTHROPIC_API_KEY environment variable is not set");
          }
    
          const command = `export ANTHROPIC_API_KEY=${apiKey} && claude -p --dangerously-skip-permissions ${fileContextString}"${escapedQueryText}" > ${outputFileName} 2>&1`;
    
          try {
            const { stdout, stderr } = await execAsync(command);
    
            return {
              query: queryText,
              command: command,
              outputFile: outputFileName,
              status: "completed",
              stdout: stdout,
              stderr: stderr,
            };
          } catch (error) {
            const err = error as Error;
            return {
              query: queryText,
              command: command,
              outputFile: outputFileName,
              status: "failed",
              error: err.message,
            };
          }
        });
    
        // Wait for all tasks to complete
        const taskExecutionResults = await Promise.all(taskPromises);
    
        const reportLines = taskExecutionResults.map(
          (r) =>
            `Task for query (first 30 chars): "${r.query.substring(
              0,
              30
            )}..." - Status: ${r.status}. Output file: ${r.outputFile}${
              r.error ? ` (Error: ${r.error})` : ""
            }`
        );
    
        return {
          content: [
            {
              type: "text",
              text: `Completed ${
                queries.length
              } Claude tasks in parallel.\\nDetails:\\n${reportLines.join("\\n")}`,
            },
          ],
        };
      }
    );
  • Zod schema defining the input parameter 'queries', an array of objects each with 'queryText' (string) and optional 'contextFilePaths' (array of strings).
      queries: z
        .array(
          z.object({
            queryText: z.string().describe("The text prompt to send to Claude"),
            contextFilePaths: z
              .array(z.string())
              .optional()
              .describe(
                "Optional list of file paths to provide as context to Claude"
              ),
          })
        )
        .describe("A list of query objects to run with Claude in parallel"),
    },
  • src/index.ts:17-21 (registration)
    Registration of the 'run_parallel_claude_tasks' tool using server.tool(), including name, description, and schema reference.
    // Tool: Run Parallel Claude Tasks
    server.tool(
      "run_parallel_claude_tasks",
      "Runs multiple Claude prompts in parallel, optionally with file contexts, redirecting output to files.",
      {
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions parallel execution and output redirection to files, which are useful behavioral traits. However, it omits critical details such as error handling, performance implications (e.g., rate limits or concurrency limits), authentication requirements, or what happens if file contexts are invalid. For a tool with no annotations, this leaves significant gaps in understanding its behavior.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that front-loads the core functionality ('Runs multiple Claude prompts in parallel') and appends key features ('optionally with file contexts, redirecting output to files'). There is no wasted verbiage, and every phrase adds meaningful information, making it highly concise and well-structured.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (parallel execution with file handling), lack of annotations, and no output schema, the description is moderately complete. It covers the basic operation and key features but misses details like error behavior, output format, or system constraints. Without annotations or output schema, more context would be helpful, but the description provides a functional overview.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents the single parameter ('queries') and its nested properties ('queryText' and 'contextFilePaths'). The description adds some value by implying that 'queries' are run in parallel and that 'contextFilePaths' are optional file contexts, but it doesn't provide additional semantic details beyond what the schema specifies. This meets the baseline for high schema coverage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Runs multiple Claude prompts in parallel, optionally with file contexts, redirecting output to files.' It specifies the verb ('Runs'), resource ('multiple Claude prompts'), and key features (parallel execution, file contexts, output redirection). Since there are no sibling tools, no differentiation is needed, making this a clear but not maximally specific description.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It mentions the tool's capabilities but offers no context about prerequisites, typical use cases, or scenarios where it might be preferred over sequential execution or other methods. Without sibling tools, this is less critical, but the description still lacks usage context.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other 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/CaptainCrouton89/claude-code-mcp'

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