diff --git a/docs/v2/en/docs/building-blocks/permission-system.md b/docs/v2/en/docs/building-blocks/permission-system.md index e4fb1d0db6..711b07a61d 100644 --- a/docs/v2/en/docs/building-blocks/permission-system.md +++ b/docs/v2/en/docs/building-blocks/permission-system.md @@ -204,12 +204,13 @@ PermissionContextState permCtx = import io.agentscope.core.event.ConfirmResult; // ASK decisions carry suggestedRules on the ToolUseBlock. -// Accept them by attaching to the result: +// Accept them by attaching to the result. +// `tool` is the ToolBase instance that received the ASK (the tool named in the pending call): ConfirmResult result = new ConfirmResult( /* confirmed = */ true, /* toolCall = */ toolCall, - /* rules = */ toolCall.getSuggestedRules()); + /* rules = */ tool.generateSuggestions(toolCall.getInput())); ``` Runnable examples: `agentscope-examples/documentation/.../tool/PermissionContextExample.java`, `hitl/PermissionHITLExample.java`. diff --git a/docs/v2/zh/docs/building-blocks/permission-system.md b/docs/v2/zh/docs/building-blocks/permission-system.md index c820d11c5f..2b3ee9d066 100644 --- a/docs/v2/zh/docs/building-blocks/permission-system.md +++ b/docs/v2/zh/docs/building-blocks/permission-system.md @@ -204,12 +204,13 @@ PermissionContextState permCtx = import io.agentscope.core.event.ConfirmResult; // ASK 决策中包含基于本次调用生成的 suggestedRules(位于 ToolUseBlock 上)。 -// 接受建议时,把它放入结果即可: +// 接受建议时,把它放入结果即可。 +// `tool` 是接收到 ASK 的 ToolBase 实例(即待确认调用中命名的 tool): ConfirmResult result = new ConfirmResult( /* confirmed = */ true, /* toolCall = */ toolCall, - /* rules = */ toolCall.getSuggestedRules()); + /* rules = */ tool.generateSuggestions(toolCall.getInput())); ``` 完整可运行示例:`agentscope-examples/documentation/.../tool/PermissionContextExample.java`、`hitl/PermissionHITLExample.java`。