Get a comprehensive list of all tools available through the Swarms API. The /v1/tools/available endpoint provides information about integrated tools and capabilities that can enhance your agents and swarms.
Tools extend agent capabilities by providing access to external services, APIs, databases, and specialized functions.
Quick Start
import requests
import json
import os
from dotenv import load_dotenv
load_dotenv()
API_KEY = os.getenv("SWARMS_API_KEY")
BASE_URL = "https://api.swarms.world"
headers = {
"x-api-key": API_KEY,
"Content-Type": "application/json"
}
def get_available_tools():
"""Get all available tools"""
response = requests.get(
f"{BASE_URL}/v1/tools/available",
headers=headers
)
if response.status_code == 200:
return response.json()
else:
print(f"Error: {response.status_code} - {response.text}")
return None
# Get available tools
tools_data = get_available_tools()
if tools_data:
print("✅ Available tools retrieved successfully!")
print(json.dumps(tools_data, indent=2))
const API_KEY = process.env.SWARMS_API_KEY;
const BASE_URL = "https://api.swarms.world";
const headers = {
"x-api-key": API_KEY,
"Content-Type": "application/json"
};
async function getAvailableTools() {
try {
const response = await fetch(`${BASE_URL}/v1/tools/available`, {
method: 'GET',
headers: headers
});
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
const data = await response.json();
console.log("✅ Available tools retrieved successfully!");
console.log(JSON.stringify(data, null, 2));
return data;
} catch (error) {
console.error('Error:', error);
return null;
}
}
// Get available tools
getAvailableTools();
# Get available tools
curl -X GET "https://api.swarms.world/v1/tools/available" \
-H "x-api-key: your-api-key" \
-H "Content-Type": "application/json"
# Example response:
# {
# "status": "success",
# "tools": [
# "web_search",
# "calculator",
# "database_query",
# "file_processor",
# "api_integrator"
# ]
# }
Web Search
Calculator
File Processor
API Integrator
payload = {
"agent_config": {
"agent_name": "Research Assistant",
"model_name": "gpt-4o",
"max_tokens": 2048,
"tools_enabled": ["web_search"]
},
"task": "Find the latest developments in quantum computing and summarize the key breakthroughs."
}
payload = {
"agent_config": {
"agent_name": "Math Assistant",
"model_name": "gpt-4o",
"max_tokens": 1024,
"tools_enabled": ["calculator"]
},
"task": "Calculate the compound interest on $10,000 at 5% annual interest over 10 years."
}
payload = {
"agent_config": {
"agent_name": "Document Analyst",
"model_name": "gpt-4o",
"max_tokens": 2048,
"tools_enabled": ["file_processor"]
},
"task": "Analyze the attached PDF document and extract the key findings and recommendations."
}
payload = {
"agent_config": {
"agent_name": "Data Collector",
"model_name": "gpt-4o",
"max_tokens": 2048,
"tools_enabled": ["api_integrator"]
},
"task": "Fetch the latest weather data for New York City and provide a forecast summary."
}
| Category | Tools | Description |
|---|
| Search & Discovery | web_search, database_query | Find and retrieve information from various sources |
| Computation | calculator, data_analyzer | Perform calculations and data analysis |
| File Processing | file_processor, document_parser | Handle and analyze files and documents |
| Integration | api_integrator, webhook_handler | Connect with external APIs and services |
| Communication | email_sender, notification_service | Send messages and notifications |
Best Practices
- Match Tools to Tasks: Choose tools that best fit your specific use case
- Avoid Overloading: Don’t enable too many tools for a single agent
- Test Combinations: Test tool combinations to ensure they work well together
- Monitor Performance: Track how tools affect response time and cost
Configuration
- Set Appropriate Limits: Configure tool-specific limits and timeouts
- Handle Errors Gracefully: Implement proper error handling for tool failures
- Cache Results: Cache tool results when appropriate to improve performance
- Security First: Ensure tools access only authorized resources
Usage Optimization
- Batch Operations: Use tools that support batch operations when possible
- Async Processing: Leverage asynchronous tool execution for better performance
- Resource Management: Monitor tool usage and resource consumption
- Cost Awareness: Be aware of costs associated with tool usage