---
docId: doc_950733d5b38e44e9938558fbc1ea23a5
title: 'Tools'
description: Give your agents actions by connecting custom APIs, MCP servers, read-only databases or your own code, with credentials stored as secrets.
---

<script>
  import { Ways } from '$lib/components';
</script>

# Tools

Let an agent perform tasks during a conversation: look up an order, book an appointment or read a database. [Find a tool in the catalog](/api-reference/tools/list) or create one using the options below, then connect it to the agent. Connecting or pausing it applies immediately, without publishing.

## Four ways to create tools

| Type | When to use it | Section |
|------|----------------|---------|
| **Custom API** | You have your own HTTP endpoint and want the agent to call it | [Custom APIs](/api-reference/custom-apis) |
| **MCP server** | The service already exposes tools over MCP and you choose which to install | [MCP servers](/api-reference/mcp-servers) |
| **Database** | You want the agent to run read-only queries on PostgreSQL or MySQL | [Databases](/api-reference/databases) |
| **Custom function** | You want to run TypeScript logic: transform data, apply business rules or call services | [Custom functions](/api-reference/custom-functions) |

The [workspace catalog](/api-reference/tools/list) also includes tools from apps installed from Platica and older HTTP tools.

## Quick example

<Ways tabs="api,sdk">
<Ways.Way name="api">

```bash
# 1. Store the credential as a secret (it never goes in the tool definition)
curl -X POST https://api.platic.ai/v1/secrets \
  -H "Authorization: Bearer $PLATIC_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "name": "Orders API", "kind": "bearer", "value": "'"$ORDERS_API_TOKEN"'" }'

# 2. Create the API
curl -X POST https://api.platic.ai/v1/tools/apis \
  -H "Authorization: Bearer $PLATIC_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "order_status",
    "description": "Looks up an order status by its number.",
    "request": { "method": "GET", "url": "https://api.example-store.com/orders/{{order}}", "auth": { "type": "bearer" } },
    "variables": [{ "name": "order", "type": "string", "description": "Order number", "required": true, "mode": "ai" }],
    "secrets": { "auth.token": "'"$SECRET_ID"'" }
  }'

# 3. Test it, publish it to the catalog and connect it to the agent
curl -X POST https://api.platic.ai/v1/tools/apis/$INTEGRATION_ID/test \
  -H "Authorization: Bearer $PLATIC_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "input": { "order": "1001" } }'
curl -X POST https://api.platic.ai/v1/tools/apis/$INTEGRATION_ID/enable \
  -H "Authorization: Bearer $PLATIC_API_KEY"
curl -X PUT https://api.platic.ai/v1/agents/$AGENT_ID/tools/$TOOL_ID \
  -H "Authorization: Bearer $PLATIC_API_KEY"
```

</Ways.Way>
<Ways.Way name="sdk">

```ts
// 1. Store the credential as a secret (it never goes in the tool definition)
const secret = await platic.secrets.create({
  name: "Orders API",
  kind: "bearer",
  value: process.env.ORDERS_API_TOKEN!,
});

// 2. Create the API, test it, publish it to the catalog and connect it to the agent
const api = await platic.tools.apis.create({
  name: "order_status",
  description: "Looks up an order status by its number.",
  request: { method: "GET", url: "https://api.example-store.com/orders/{{order}}", auth: { type: "bearer" } },
  variables: [{ name: "order", type: "string", description: "Order number", required: true, mode: "ai" }],
  secrets: { "auth.token": secret.id },
});
const test = await platic.tools.apis.test(api.id, { input: { order: "1001" } });
if (test.success) {
  const { toolId } = await platic.tools.apis.enable(api.id);
  await platic.agents.tools.connect(agentId, toolId);
}
```

</Ways.Way>
</Ways>

## What you need to know

- **Credentials go in secrets:** no API or MCP server stores tokens in its definition; if you send a credential directly it answers `400 SECRET_REFERENCE_REQUIRED` with the slot where to bind the [secret](/api-reference/secrets).
- **Being in the catalog does not connect it to the agent:** publishing an API, syncing tools from an MCP server or connecting a database only adds them to the catalog. Then give them to each agent with [Connect a tool](/api-reference/agents/tools/connect).
- **Three different states:** the **source's** (`draft`/`enabled`/`paused` or `connected`), each **secret slot's** (`authorized`/`needs_authorization`/`missing`) and the **connection on the agent's** (`active`/`paused`).
- **Permissions:** requires **Integrations** (and secret permissions when managing credentials).

## Where to go next

- [Workspace catalog](/api-reference/tools/list) and [agent tools](/api-reference/agents/tools/list).
- [Secrets](/api-reference/secrets), [Custom APIs](/api-reference/custom-apis), [MCP servers](/api-reference/mcp-servers), [Databases](/api-reference/databases) and [Custom functions](/api-reference/custom-functions).
- Errors in [Errors](/api-reference/errors) and AI tools in the [Tools MCP tools](/mcp/tools#tools).
