Skip to main content
Glama

claude_async

Destructive

Launch Claude Code tasks asynchronously for parallel fan-out and return a task_id; collect results with claude_wait in the same turn to avoid stranded output.

Instructions

Launch a Claude Code task and return immediately with a task_id for parallel fan-out, then collect with a single claude_wait. CRITICAL: the task_id is internal to this server and NOT tracked by your MCP client -- you MUST call claude_wait in the same turn or results are stranded on disk. Pass session_id to resume an existing session asynchronously, and set worktree=true to isolate parallel edits in a HEAD-based git worktree.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "prompt": "<prompt>"
    },
    "name": "claude_async"
  }
}

Input Schema

NameRequiredDescriptionDefault
cwdNoWorking directory for the Claude Code session. If relative, resolved against the server's cwd. On resume, defaults to the original session's cwd/worktree when omitted.
bareNoMinimal headless mode skipping hooks, plugins, CLAUDE.md discovery, and OAuth/keychain reads (passes --bare; requires API key or provider credentials).
agentNoNamed agent for this session (passes --agent).
modelNoOptional model alias or full model name (e.g. 'opus', 'sonnet', 'haiku', 'fable', or a full model identifier). Call claude_models to list available models, resolved IDs, and supported effort levels.
toolsNoBuilt-in tools to expose: "" or [] for none, "default" for the default set, or comma-separated/array tool names (e.g. ["Read","Edit","Bash"]).
agentsNoCustom agents definition (JSON object or file path; passes --agents).
effortNoReasoning effort level for this session.
promptYesThe user prompt for the Claude Code session.
add_dirNoAdditional directories Claude can access (passes repeatable --add-dir).
settingsNoExtra settings to load (JSON object or file path; passes --settings). Prefer file paths over inline credentials.
worktreeNoCreate an isolated git worktree and branch (claude-swarm/<task_id>) based on HEAD so parallel tasks never conflict. Note: branches from HEAD and excludes uncommitted or untracked working-tree changes -- commit them first if the task needs them. Merge the branch back before expiry.
max_turnsNoMaximum number of agentic turns for this invocation (passes --max-turns).
mcp_configNoMCP server configurations to load (array of JSON objects or file paths/JSON strings; passes repeatable --mcp-config).
session_idNoOptional session ID (or session name) from a previous Claude call. When set, resumes that conversation via --resume instead of starting fresh.
json_schemaNoOptional JSON Schema (object or string) passed to --json-schema so Claude Code returns structuredContent.structured_output via its StructuredOutput tool. Callers should verify structured_output is present, as Claude CLI can still exit 0 without it on short-circuited CLI commands or prose fallbacks.
fork_sessionNoWhen resuming via session_id, create a new session ID instead of mutating the original session (passes --fork-session).
allowed_toolsNoTool allow rules (e.g. ["Bash(git *)", "Edit"]; passes --allowed-tools).
system_promptNoReplace the default system prompt (passes --system-prompt).
fallback_modelNoOptional fallback model(s) (comma-separated) when the primary model is busy or unavailable (passes --fallback-model).
max_budget_usdNoMaximum API spend in USD for this invocation (passes --max-budget-usd).
permission_modeNoPermission mode for tool approval (acceptEdits, auto, bypassPermissions, manual, dontAsk, plan).
setting_sourcesNoComma-separated setting sources to load (e.g. "user,project,local", or "" to exclude all user/project/local settings).
disallowed_toolsNoTool deny rules (e.g. ["Bash(rm *)"]; passes --disallowed-tools).
strict_mcp_configNoOnly use MCP servers from mcp_config, ignoring all other MCP configs (passes --strict-mcp-config). Explicit false overrides server default.
append_system_promptNoAppend text to the default system prompt (passes --append-system-prompt).
disable_slash_commandsNoDisable all skills and slash commands (passes --disable-slash-commands). Explicit false overrides server default.
no_session_persistenceNoDo not save the session transcript to disk; cannot be resumed later (passes --no-session-persistence). Explicit false overrides server default.
dangerously_skip_permissionsNoBypass all permission checks (passes --dangerously-skip-permissions). Explicit false overrides server default.

Output Schema

NameRequiredDescriptionDefault
errorNo
modelNo
statusYes
task_idNo
worktree_pathNo
worktree_branchNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.6/5.0
Behavior5/5

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

Annotations already flag destructive/openWorld/non-idempotent, and the description adds non-derivable behavior: the task_id is server-internal and untracked by the MCP client, and failing to collect strands results on disk. It also warns that worktree branches from HEAD, excludes uncommitted changes, and must be merged before expiry.

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?

Two dense sentences with no filler, and the launch-and-collect contract is front-loaded ahead of the caveats. The CRITICAL warning is somewhat buried mid-sentence rather than given its own line, which slightly hurts scannability.

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

Completeness5/5

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

For a 28-parameter, destructive, open-world launcher with an output schema and rich annotations, the description covers exactly the non-obvious hazards: the collection requirement, the internal task_id, worktree isolation and cleanup, and resume semantics. Everything else is adequately carried by structured fields.

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% across 28 params, so the baseline is 3; the description still earns credit for explaining the consequences of session_id (resume instead of fresh start) and worktree (HEAD-only branching, uncommitted changes excluded, merge before expiry). Most of the remaining parameters, such as effort, permission_mode, or max_budget_usd, are only meaningful through the schema.

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?

States a specific verb and resource ('Launch a Claude Code task') plus the return contract ('return immediately with a task_id') and the intended pattern ('parallel fan-out'), and names claude_wait as the collection counterpart. An agent can distinguish this from the synchronous sibling without opening the schema.

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?

Gives explicit workflow rules: you MUST call claude_wait in the same turn, pass session_id to resume asynchronously, and set worktree=true to isolate parallel edits. It stops short of stating when to prefer this over the synchronous 'claude' tool or when to use claude_cancel on a launched task.

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