The Tools API allows you to manage and organize the tools that agents have learned and used within your Acontext projects. You can view all available tools and rename them for better organization and consistency.
Retrieve a comprehensive list of all tools that have been used by agents in your project, along with usage statistics.
from acontext import AcontextClient
client = AcontextClient(
api_key="sk-ac-your-root-api-bearer-token",
base_url="http://localhost:8029/api/v1"
)
# Get all tool names with usage statistics
tools = client.tools.get_tool_name()
for tool in tools:
print(f"{tool.name} (used in {tool.sop_count} SOPs)")
The sop_count field indicates how many Standard Operating Procedures (SOPs) reference each tool, helping you understand tool usage patterns across your project.
Rename multiple tools simultaneously to maintain consistency and improve organization across your project. This is particularly useful when standardizing tool names or updating naming conventions.
from acontext import AcontextClient
client = AcontextClient(
api_key="sk-ac-your-root-api-bearer-token",
base_url="http://localhost:8029/api/v1"
)
# Rename multiple tools at once
result = client.tools.rename_tool_name(
rename=[
{"old_name": "calculate", "new_name": "calculate_math"},
{"old_name": "search", "new_name": "search_web"},
{"old_name": "file_reader", "new_name": "read_file"}
]
)
if result.status == 0:
print("Tools renamed successfully")
else:
print(f"Error: {result.errmsg}")
Renaming tools will update all references across your project’s SOPs. Make sure the new names follow your project’s naming conventions and don’t conflict with existing tools.
Best Practices
Consistent Naming: Use descriptive, consistent naming patterns for your tools. Consider prefixes like web_, file_, or calc_ to group related functionality.
Tool names are case-sensitive and should follow standard identifier conventions (alphanumeric characters and underscores).