Skip to main content

Two Search Patterns

There are two ways to use tool search, depending on who drives the discovery:
You search, LLM gets pre-filtered tools.Your code calls searchTools() with a natural language query, gets back a filtered Tools collection, and passes those tools to the LLM. The LLM only sees relevant tools - not the entire catalog.Best for:
  • Known tasks where you can predict which tools are needed
  • Constrained agents with a focused scope
  • When you want full control over which tools the LLM can access
AspectDeveloper-DrivenAgent-Driven
Tools sent to LLMFiltered set (5-20)Always 2 (tool_search + tool_execute)
Token costScales with number of toolsConstant
DiscoveryDeveloper searches upfrontLLM discovers on-demand
ExecutionDeveloper or framework executesLLM calls tool_execute or framework handles it
Use caseConstrained, known tasksOpen-ended, exploratory
Tool search enables AI agents to discover the right tools using natural language queries, without requiring exact action names.

Key Features

Scales to Thousands of Tools

StackOne has 10,000+ actions. Search returns only the relevant ones for each query.

Improves Accuracy

Only relevant tools exposed per request, reducing misfires and hallucinations.

Account-Aware

Filters results to tools available for configured account IDs, respecting auth boundaries.

Framework-Ready

Returns a Tools collection with converters for OpenAI, LangChain, Vercel AI SDK, and more.

Architecture Overview

Flow:
  1. User sends a natural language query to your AI agent
  2. Agent calls Search Tools to find relevant actions
  3. Search Tools discovers available connectors and tool schemas via MCP, then ranks actions via the Semantic Search API
  4. Search results are matched to MCP tool definitions, sorted by relevance
  5. Agent receives a ranked Tools collection
  6. Agent calls execute() on the selected tool

Quick Example

import { StackOneToolSet } from '@stackone/ai';

const toolset = new StackOneToolSet();

// Search for tools by intent
const tools = await toolset.searchTools('manage employee time off', {
  topK: 5,
  search: 'auto',
});

// Use with OpenAI, Vercel AI SDK, etc.
const openAITools = tools.toOpenAI();

Next Steps