AS AgentScopeAPI 手册 / API Reference
类class agentscope.tool

ResetTools

class ResetTools(ToolBase)
源码Source 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
namestr
名称字段。
'reset_tools'
descriptionstr
`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_mcpbool
是 MCP字段。
False
is_read_onlybool
`is_read_only` 字段。
False
is_concurrency_safebool
`is_concurrency_safe` 字段。
True
is_external_toolbool
是外部工具字段。
False
is_state_injectedbool
`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.

参数Parameters
名称Name类型Type说明Description
groupslist[ToolGroup]组(类型 `list[ToolGroup]`)。The groups.
response_templatestr响应模板(类型 `str`)。The response template.
middlewares默认default NoneList[ToolMiddlewareBase] | None中间件列表(类型 `List[ToolMiddlewareBase] | None`)。The middlewares.
源码Source agentscope/tool/_builtin/_meta.py:48–57

属性详情Attribute Detail

name

str = 'reset_tools'

名称字段。声明为 str。

The name field.

源码Source agentscope/tool/_builtin/_meta.py:25

description

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.

源码Source agentscope/tool/_builtin/_meta.py:26

is_mcp

bool = False

是 MCP字段。声明为 bool。

The is mcp field.

源码Source agentscope/tool/_builtin/_meta.py:42

is_read_only

bool = False

is_read_only 字段。声明为 bool。

The is read only field.

源码Source agentscope/tool/_builtin/_meta.py:43

is_concurrency_safe

bool = True

is_concurrency_safe 字段。声明为 bool。

The is concurrency safe field.

源码Source agentscope/tool/_builtin/_meta.py:44

is_external_tool

bool = False

是外部工具字段。声明为 bool。

The is external tool field.

源码Source agentscope/tool/_builtin/_meta.py:45

is_state_injected

bool = True

is_state_injected 字段。声明为 bool。

The is state injected field.

源码Source 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.

返回Returns dict[str, Any]
返回dict[str,任意]。Returns dict str any.
源码Source agentscope/tool/_builtin/_meta.py:60–77

方法详情Method Detail

check_permissions

async def check_permissions(tool_input: dict[str, Any], context: PermissionContext) -> PermissionDecision
async

检查权限。

The meta tool is always allowed to be called.

参数Parameters
名称Name类型Type说明Description
tool_inputdict[str, Any]工具输入(类型 `dict[str, Any]`)。The tool input.
contextPermissionContext上下文(类型 `PermissionContext`)。The context.
返回Returns PermissionDecision
返回PermissionDecision。Returns permission decision.
源码Source agentscope/tool/_builtin/_meta.py:79–88

call

async def call(_agent_state: AgentState, **kwargs: Any) -> ToolChunk
async

向智能体发送输入并返回最终回复。

Activate or deactivate tool groups based on the input arguments, and return their usage instructions.

参数Parameters
名称Name类型Type说明Description
_agent_stateAgentState智能体状态(类型 `AgentState`)。The agent state.
kwargsAny关键字参数(类型 `Any`)。The kwargs.
返回Returns ToolChunk
返回ToolChunk。Returns tool chunk.
源码Source agentscope/tool/_builtin/_meta.py:90–154

继承成员Inherited Members

基于官方固定版本源码静态生成Generated from pinned official sources · Python 2.0.11 · Java 2.0.4
签名与文档为静态抽取;如有疑问请以源码为准。Signatures and docs are extracted statically; verify against the source when in doubt.