AS AgentScopeAPI 手册 / API Reference

Builder

public static final class Builder
源码Source io/agentscope/core/tool/ToolBase.java:313–386

构建器,用于构建并配置目标实例。位于 io.agentscope.core.tool 包。核心成员包括 name、description、inputSchema、readOnly、concurrencySafe、externalTool。

Fluent builder for ToolBase subclasses.

方法摘要Method Summary

方法Method说明Description
public Builder name(String name)
设置名称。
Performs the name operation.
public Builder description(String description)
设置该配置项。
Performs the description operation.
public Builder inputSchema(Map<String, Object> inputSchema)
设置输入模式。
Performs the input schema operation.
public Builder readOnly(boolean readOnly)
设置该配置项。
Performs the read only operation.
public Builder concurrencySafe(boolean concurrencySafe)
设置该配置项。
Performs the concurrency safe operation.
public Builder externalTool(boolean externalTool)
设置外部工具。
Performs the external tool operation.
public Builder stateInjected(boolean stateInjected)
设置该配置项。
Performs the state injected operation.
public Builder returnDirect(boolean returnDirect)
设置该配置项。
Sets whether this tool's result should be returned directly to the caller.
public Builder mcp(String mcpName)
设置MCP。
Marks the tool as an MCP tool and records the MCP server name.
public Builder dangerousFiles(List<String> dangerousFiles)
设置该配置项。
Performs the dangerous files operation.
public Builder dangerousDirectories(List<String> dangerousDirectories)
设置该配置项。
Performs the dangerous directories operation.

方法详情Method Detail

name

public Builder name(String name)

设置名称。

Performs the name operation.

参数Parameters
名称Name类型Type说明Description
nameString名称(类型 `String`)。The name.
返回Returns Builder
返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source io/agentscope/core/tool/ToolBase.java:329–332

description

public Builder description(String description)

设置该配置项。

Performs the description operation.

参数Parameters
名称Name类型Type说明Description
descriptionString描述(类型 `String`)。The description.
返回Returns Builder
返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source io/agentscope/core/tool/ToolBase.java:334–337

inputSchema

public Builder inputSchema(Map<String, Object> inputSchema)

设置输入模式。

Performs the input schema operation.

参数Parameters
名称Name类型Type说明Description
inputSchemaMap<String, Object>输入模式(类型 `Map`)。The input schema.
返回Returns Builder
返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source io/agentscope/core/tool/ToolBase.java:339–342

readOnly

public Builder readOnly(boolean readOnly)

设置该配置项。

Performs the read only operation.

参数Parameters
名称Name类型Type说明Description
readOnlyboolean读取 Only(类型 `boolean`)。The read only.
返回Returns Builder
返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source io/agentscope/core/tool/ToolBase.java:344–347

concurrencySafe

public Builder concurrencySafe(boolean concurrencySafe)

设置该配置项。

Performs the concurrency safe operation.

参数Parameters
名称Name类型Type说明Description
concurrencySafebooleanconcurrency 安全(类型 `boolean`)。The concurrency safe.
返回Returns Builder
返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source io/agentscope/core/tool/ToolBase.java:349–352

externalTool

public Builder externalTool(boolean externalTool)

设置外部工具。

Performs the external tool operation.

参数Parameters
名称Name类型Type说明Description
externalToolboolean外部工具(类型 `boolean`)。The external tool.
返回Returns Builder
返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source io/agentscope/core/tool/ToolBase.java:354–357

stateInjected

public Builder stateInjected(boolean stateInjected)

设置该配置项。

Performs the state injected operation.

参数Parameters
名称Name类型Type说明Description
stateInjectedboolean状态 Injected(类型 `boolean`)。The state injected.
返回Returns Builder
返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source io/agentscope/core/tool/ToolBase.java:359–362

returnDirect

public Builder returnDirect(boolean returnDirect)

设置该配置项。

Sets whether this tool's result should be returned directly to the caller.

参数Parameters
名称Name类型Type说明Description
returnDirectbooleanreturn Direct(类型 `boolean`)。The return direct.
返回Returns Builder
返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source io/agentscope/core/tool/ToolBase.java:365–368

mcp

public Builder mcp(String mcpName)

设置MCP。

Marks the tool as an MCP tool and records the MCP server name.

参数Parameters
名称Name类型Type说明Description
mcpNameStringMCP 名称(类型 `String`)。The mcp name.
返回Returns Builder
返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source io/agentscope/core/tool/ToolBase.java:371–375

dangerousFiles

public Builder dangerousFiles(List<String> dangerousFiles)

设置该配置项。

Performs the dangerous files operation.

参数Parameters
名称Name类型Type说明Description
dangerousFilesList<String>dangerous 文件(类型 `List`)。The dangerous files.
返回Returns Builder
返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source io/agentscope/core/tool/ToolBase.java:377–380

dangerousDirectories

public Builder dangerousDirectories(List<String> dangerousDirectories)

设置该配置项。

Performs the dangerous directories operation.

参数Parameters
名称Name类型Type说明Description
dangerousDirectoriesList<String>dangerous Directories(类型 `List`)。The dangerous directories.
返回Returns Builder
返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source io/agentscope/core/tool/ToolBase.java:382–385
基于官方固定版本源码静态生成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.