Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions website/docs/developer-guide/plugins/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -1204,7 +1204,7 @@ def register(ctx):

### Dispatch tools from slash commands

Slash command handlers that need to orchestrate tools (spawn a subagent via `delegate_task`, call `file_edit`, etc.) should use `ctx.dispatch_tool()` instead of reaching into framework internals. The parent-agent context (workspace hints, spinner, model inheritance) is wired up automatically.
Slash command handlers that need to orchestrate tools (spawn a subagent via `delegate_task`, call `write_file`, etc.) should use `ctx.dispatch_tool()` instead of reaching into framework internals. The parent-agent context (workspace hints, spinner, model inheritance) is wired up automatically.

```python
def register(ctx):
Expand All @@ -1229,7 +1229,7 @@ def register(ctx):

| Parameter | Type | Description |
|-----------|------|-------------|
| `name` | `str` | Tool name as registered in the tool registry (e.g. `"delegate_task"`, `"file_edit"`) |
| `name` | `str` | Tool name as registered in the tool registry (e.g. `"delegate_task"`, `"write_file"`) |
| `args` | `dict` | Tool arguments, same shape the model would send |
| `parent_agent` | `Agent \| None` | Optional override. When omitted, resolves from the current CLI agent (or degrades gracefully in gateway mode) |

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -732,7 +732,7 @@ def register(ctx):

### 从斜杠命令分发工具

需要编排工具的斜杠命令处理器(生成子代理 `delegate_task`、调用 `file_edit` 等)应使用 `ctx.dispatch_tool()`,而非深入框架内部。父代理上下文(工作区提示、spinner、模型继承)会自动连接。
需要编排工具的斜杠命令处理器(生成子代理 `delegate_task`、调用 `write_file` 等)应使用 `ctx.dispatch_tool()`,而非深入框架内部。父代理上下文(工作区提示、spinner、模型继承)会自动连接。

```python
def register(ctx):
Expand All @@ -757,7 +757,7 @@ def register(ctx):

| 参数 | 类型 | 描述 |
|-----------|------|-------------|
| `name` | `str` | 工具注册表中的工具名称(例如 `"delegate_task"`、`"file_edit"`) |
| `name` | `str` | 工具注册表中的工具名称(例如 `"delegate_task"`、`"write_file"`) |
| `args` | `dict` | 工具参数,与模型发送的格式相同 |
| `parent_agent` | `Agent \| None` | 可选覆盖。省略时从当前 CLI 代理解析(网关模式下优雅降级) |

Expand Down