agentscope.toolResetTools
class ResetTools(ToolBase)
agentscope/tool/_builtin/_meta.py:21–154重置工具,封装可被智能体调用的能力。位于 agentscope.tool 包,继承自 ToolBase。核心成员包括 check_permissions、call、input_schema。
A meta tool allows agent to self-manage its equipped tools by activating or deactivating tool groups dynamically. Declared in agentscope.tool. Extends ToolBase.
构造器摘要Constructor Summary
| 构造器Constructor | 说明Description |
|---|---|
def __init__(groups: list[ToolGroup], response_template: str, middlewares: List[ToolMiddlewareBase] | None = None) -> N… | 初始化 `ResetTools` 实例。 Initialize the meta tool with the current tool groups. |
属性摘要Property Summary
| 属性Property | 说明Description |
|---|---|
input_schema | 获取输入模式。 Dynamically generate the input schema based on the current available tool groups. |
属性摘要Attribute Summary
| 属性Attribute | 类型Type | 说明Description | 值Value |
|---|---|---|---|
name | str | 名称字段。 | 'reset_tools' |
description | str | `description` 字段。 | 'This tool allows you to reset your equipped tools based on your current task requirements. These tools are organized into different groups, and you can activate/deactivate them by specifying the boolean values for each group in the input.\n\n**Important: The input booleans are the final state of their corresponding tool groups, not incremental changes.** Any group not explicitly set to True will be deactivated, regardless of its previous state.\n\n**Best practice**: Actively manage your tool groups——activate only what you need for the current task, and promptly deactivate groups as soon as they are no longer needed to conserve context space.\n\nThis tool will return the usage instructions for the activated tool groups, which you **MUST pay attention to and follow**. You can also reuse this tool to re-check the instructions.' |
is_mcp | bool | 是 MCP字段。 | False |
is_read_only | bool | `is_read_only` 字段。 | False |
is_concurrency_safe | bool | `is_concurrency_safe` 字段。 | True |
is_external_tool | bool | 是外部工具字段。 | False |
is_state_injected | bool | `is_state_injected` 字段。 | True |
方法摘要Method Summary
| 方法Method | 说明Description |
|---|---|
async def check_permissions(tool_input: dict[str, Any], context: PermissionContext) -> PermissionDecisionasync | 检查权限。 The meta tool is always allowed to be called. |
async def call(_agent_state: AgentState, **kwargs: Any) -> ToolChunkasync | 向智能体发送输入并返回最终回复。 Activate or deactivate tool groups based on the input arguments, and return their usage instructions. |
构造器详情Constructor Detail
ResetTools
def __init__(groups: list[ToolGroup], response_template: str, middlewares: List[ToolMiddlewareBase] | None = None) -> None
初始化 ResetTools 实例。
Initialize the meta tool with the current tool groups.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
groups | list[ToolGroup] | 组(类型 `list[ToolGroup]`)。The groups. |
response_template | str | 响应模板(类型 `str`)。The response template. |
middlewares默认default None | List[ToolMiddlewareBase] | None | 中间件列表(类型 `List[ToolMiddlewareBase] | None`)。The middlewares. |
agentscope/tool/_builtin/_meta.py:48–57属性详情Attribute Detail
name
str = 'reset_tools'名称字段。声明为 str。
The name field.
agentscope/tool/_builtin/_meta.py:25description
str = 'This tool allows you to reset your equipped tools based on your current task requirements. These tools are organized into different groups, and you can activate/deactivate them by specifying the boolean values for each group in the input.\n\n**Important: The input booleans are the final state of their corresponding tool groups, not incremental changes.** Any group not explicitly set to True will be deactivated, regardless of its previous state.\n\n**Best practice**: Actively manage your tool groups——activate only what you need for the current task, and promptly deactivate groups as soon as they are no longer needed to conserve context space.\n\nThis tool will return the usage instructions for the activated tool groups, which you **MUST pay attention to and follow**. You can also reuse this tool to re-check the instructions.'description 字段。声明为 str。
The description field.
agentscope/tool/_builtin/_meta.py:26is_mcp
bool = False是 MCP字段。声明为 bool。
The is mcp field.
agentscope/tool/_builtin/_meta.py:42is_read_only
bool = Falseis_read_only 字段。声明为 bool。
The is read only field.
agentscope/tool/_builtin/_meta.py:43is_concurrency_safe
bool = Trueis_concurrency_safe 字段。声明为 bool。
The is concurrency safe field.
agentscope/tool/_builtin/_meta.py:44is_external_tool
bool = False是外部工具字段。声明为 bool。
The is external tool field.
agentscope/tool/_builtin/_meta.py:45is_state_injected
bool = Trueis_state_injected 字段。声明为 bool。
The is state injected field.
agentscope/tool/_builtin/_meta.py:46属性详情Property Detail
input_schema
def input_schema() -> dict[str, Any]
获取输入模式。
Dynamically generate the input schema based on the current available tool groups.
agentscope/tool/_builtin/_meta.py:60–77方法详情Method Detail
check_permissions
async def check_permissions(tool_input: dict[str, Any], context: PermissionContext) -> PermissionDecision
检查权限。
The meta tool is always allowed to be called.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
tool_input | dict[str, Any] | 工具输入(类型 `dict[str, Any]`)。The tool input. |
context | PermissionContext | 上下文(类型 `PermissionContext`)。The context. |
agentscope/tool/_builtin/_meta.py:79–88call
async def call(_agent_state: AgentState, **kwargs: Any) -> ToolChunk
向智能体发送输入并返回最终回复。
Activate or deactivate tool groups based on the input arguments, and return their usage instructions.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
_agent_state | AgentState | 智能体状态(类型 `AgentState`)。The agent state. |
kwargs | Any | 关键字参数(类型 `Any`)。The kwargs. |
agentscope/tool/_builtin/_meta.py:90–154