> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://platform.bctrl.ai/llms.txt.
> For full documentation content, see https://platform.bctrl.ai/llms-full.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://platform.bctrl.ai/_mcp/server.

# Tools & Toolsets

> Define callable tools and bundle them into toolsets for agents.

A tool is a callable capability you give to [hosted agents](/sdk/hosted-agents) - a webhook to your backend, or code BCTRL hosts and runs. Bundle tools into a toolset, hand the toolset to an agent, and inspect each invocation as a tool call.

## Create a tool

A webhook tool calls your own endpoint:

```ts
const tool = await bctrl.tools.create({
  type: "webhook",
  name: "create-order",
  url: "https://api.acme.com/orders",
  timeoutMs: 10_000,
});
```

A hosted tool runs code on BCTRL:

```ts
const tool = await bctrl.tools.create({
  type: "hosted",
  name: "summarize",
  source: "export default async (input) => ({ summary: input.text.slice(0, 280) })",
});
```

## Test a tool

```ts
const result = await bctrl.tools.test(tool.id, { input: { text: "hello" } });
```

## Toolsets

Bundle tools and builtins into a toolset. The builtins are `files`, `vault`, and `captcha`:

```ts
const toolset = await bctrl.toolsets.create({
  name: "ordering",
  builtins: ["files", "vault", "captcha"],
  toolIds: [tool.id],
});
```

Hand it to an agent:

```ts
await bctrl.runtimes.invocations.browserUse.agent(runtime.id, {
  instruction: "Place the order and confirm it.",
  toolsetId: toolset.id,
});
```

## Tool calls

Every invocation of a tool is recorded. Filter by run for debugging and audit:

```ts
const { data } = await bctrl.toolCalls.list({ runId });
const call = await bctrl.toolCalls.get("tc_123");
```

## Next

* [Hosted agents](/sdk/hosted-agents) - give agents tools
* [Invocations](/sdk/invocations) - the calling context
* [Vault](/sdk/vault) - secrets a tool can reference