Skip to main content
Glama

run_agent_across_list

Spawns AI coding agents for each item in a list to perform complex analysis, refactoring, or generation across multiple files, running in parallel batches of 10.

Instructions

Spawns an AI coding agent for each item in a previously created list. Agents run in batches of 10 parallel processes with automatic permission skipping enabled.

WHEN TO USE:

  • Performing complex code analysis, refactoring, or generation across multiple files

  • Tasks that require AI reasoning rather than simple shell commands

  • When you need to delegate work to multiple AI agents working in parallel

AVAILABLE AGENTS:

  • claude: Claude Code CLI (uses --dangerously-skip-permissions for autonomous operation)

  • gemini: Google Gemini CLI (uses --yolo for auto-accept)

  • codex: OpenAI Codex CLI (uses --dangerously-bypass-approvals-and-sandbox for autonomous operation)

  • opencode: OpenCode CLI (uses run command for non-interactive autonomous operation)

HOW IT WORKS:

  1. Each item in the list is substituted into the prompt where {{item}} appears

  2. Agents run in batches of 10 at a time to avoid overwhelming the system

  3. Output streams directly to files as the agents work

  4. This tool waits for all agents to complete before returning

AFTER COMPLETION:

  • Read the stdout files to check the results from each agent

  • Check stderr files if you encounter errors

  • Files are named based on the item (e.g., "myfile.ts.stdout.txt")

VARIABLE SUBSTITUTION:

  • Use {{item}} in your prompt - it will be replaced with each list item

  • Example: "Review {{item}} for bugs" becomes "Review src/file.ts for bugs" for item "src/file.ts"

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
agentYesWhich AI agent to use: 'claude', 'gemini', 'codex', 'opencode'. All agents run with permission-skipping flags for autonomous operation.
modelNoOptional model to use. Passed as --model to the agent CLI. Examples: 'claude-opus-4-6', 'claude-sonnet-4-6' for Claude; 'gemini-2.5-pro' for Gemini; 'o3' for Codex.
promptYesThe prompt to send to each agent. Use {{item}} as a placeholder - it will be replaced with the current item value. Example: 'Review {{item}} and suggest improvements' or 'Add error handling to {{item}}'
list_idYesThe list ID returned by create_list. This identifies which list of items to iterate over.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv0.2.7
    • addedInput schema / properties / model
      Added value: +{
      +  "description": "Optional model to use. Passed as --model to the agent CLI. Examples: 'claude-opus-4-6', 'claude-sonnet-4-6' for Claude; 'gemini-2.5-pro' for Gemini; 'o3' for Codex.",
      +  "type": "string"
      +}
  2. Changed2 schema fields changedv1.0.0
    • changedInput schema / properties / agent / description
      Previous value: -"Which AI agent to use: 'claude', 'gemini', 'codex'. All agents run with permission-skipping flags for autonomous operation."New value: +"Which AI agent to use: 'claude', 'gemini', 'codex', 'opencode'. All agents run with permission-skipping flags for autonomous operation."
    • changedInput schema / properties / agent / enum
      Previous value: -[
      -  "claude",
      -  "gemini",
      -  "codex"
      -]New value: +[
      +  "claude",
      +  "gemini",
      +  "codex",
      +  "opencode"
      +]
  3. First observed

TDQS

A4.3/5.0
Behavior4/5

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

With no annotations, the description carries the full burden and does substantial work: batching of 10, automatic permission skipping, agent-specific flags, streaming output to files, and blocking until all agents finish. It falls just short of explicitly warning about potential filesystem modifications from autonomous agents.

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

Conciseness4/5

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

The description is longer than average but well-organized with clear sections and front-loaded purpose. Some redundancy exists between HOW IT WORKS and VARIABLE SUBSTITUTION, but each section is otherwise purposeful.

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

Completeness4/5

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

For a complex tool with no output schema or annotations, the description covers the input lifecycle, concurrency behavior, output file naming, and post-completion steps. It does not describe failure handling or partial-failure behavior, but the provided details are sufficient for correct invocation.

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

Parameters4/5

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

Schema coverage is 100%, so the baseline is 3, but the description adds meaningful context: how list_id connects to create_list, how {{item}} substitution works, and how agent choices map to CLI flags. This goes beyond the schema descriptions.

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

Purpose5/5

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

The first sentence states a precise verb, resource, and scope: it spawns an AI coding agent for each item in a previously created list. It also differentiates itself from the shell-based sibling by emphasizing AI reasoning and parallel agents.

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

Usage Guidelines4/5

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

A dedicated WHEN TO USE section gives concrete contexts: complex analysis, refactoring, generation, and tasks needing AI rather than simple shell commands. It does not include explicit when-not-to-use or name the sibling tool, but the contrast with shell commands provides clear routing.

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