Meta Tools provide dynamic tool discovery and execution capabilities for Python applications, allowing your AI agents to explore and use tools at runtime.

Quick Start

from stackone_ai import StackOneToolSet

# Initialize the toolset
toolset = StackOneToolSet()

# Get tools for your account
all_tools = toolset.get_tools("*", account_id="your_account_id")

# Get meta tools for dynamic discovery
meta_tools = all_tools.meta_tools()

# Search for relevant tools
search_tool = meta_tools.get_tool("meta_search_tools")
result = search_tool.call(
    query="manage employees create update list",
    limit=5,
    minScore=0.3
)

print("Found tools:")
for tool in result.get("tools", []):
    print(f"- {tool['name']} (score: {tool['score']:.2f})")

# Execute a discovered tool
execute_tool = meta_tools.get_tool("meta_execute_tool")
if result.get("tools"):
    best_tool = result["tools"][0]
    execution_result = execute_tool.call(
        tool_name=best_tool["name"],
        params={"limit": 10}
    )
    print(f"Result: {execution_result}")

Core Functions

meta_search_tools

Search for relevant tools based on natural language queries:
search_tool = meta_tools.get_tool("meta_search_tools")
result = search_tool.call(
    query="employee time off management",
    limit=3,
    minScore=0.4
)

meta_execute_tool

Execute any tool dynamically by name:
execute_tool = meta_tools.get_tool("meta_execute_tool")
result = execute_tool.call(
    tool_name="hris_list_employees",
    params={"department": "engineering", "limit": 20}
)

Framework Integration

LangChain

from langchain_openai import ChatOpenAI

# Convert to LangChain tools
langchain_tools = meta_tools.to_langchain()
model = ChatOpenAI(model="gpt-4o-mini")
model_with_tools = model.bind_tools(langchain_tools)

response = model_with_tools.invoke(
    "Find employee management tools and list recent hires"
)

CrewAI

from crewai import Agent

# Convert to CrewAI tools
crewai_tools = meta_tools.to_crewai()

hr_agent = Agent(
    role="HR Assistant",
    goal="Help with employee management tasks",
    tools=crewai_tools,
    verbose=True
)

Best Practices

  1. Cache Tool Searches: Store search results to avoid repeated API calls
  2. Handle Failures: Meta tools may fail if integrations are unavailable
  3. Use Specific Queries: More specific searches return better results
  4. Validate Parameters: Check tool parameters before execution
  5. Set Reasonable Limits: Don’t search for too many tools at once

Next Steps