> ## Documentation Index
> Fetch the complete documentation index at: https://docs.runtools.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Tools SDK

> Search, install, configure, and execute tools

`rt.tools` is the runtime side of the Tool Hub — discover tools, install them, manage credentials, and execute actions, all with the caller's auth. To *build* a tool, see [Custom Tools](/sdk/custom-tools).

## Marketplace

```typescript theme={null}
const marketplace = await rt.tools.marketplace();
const github = await rt.tools.get('github');
const matches = await rt.tools.search('email');
```

## Installed Tools

```typescript theme={null}
await rt.tools.install('github');

const installed = await rt.tools.list();

await rt.tools.uninstall('github');
```

Admins can pass `{ all: true }` to `list()` and `custom()` for broader org views.

## Credentials

```typescript theme={null}
await rt.tools.storeCredentials('my-api-tool', {
  apiKey: process.env.MY_API_KEY!,
});

const status = await rt.tools.credentials('my-api-tool');

await rt.tools.clearCredentials('my-api-tool');
```

OAuth tools should normally use [Connected Apps](/advanced/oauth) instead of stored manual credentials.

If more than one account is connected for a provider, execution uses your default account unless you pass `oauth.account` or `oauth.connectionId`:

```typescript theme={null}
await rt.tools.execute('gmail', {
  action: 'list_emails',
  params: { query: 'from:hello@example.com' },
  oauth: {
    account: 'artkara2002@gmail.com',
  },
});
```

## Execute

```typescript theme={null}
const result = await rt.tools.execute('github', {
  action: 'list_repos',
  params: {},
});

if (result.success) {
  console.log(result.result);
} else {
  console.error(result.error?.message);
}
```

Use `credentialOverrides` to map a tool credential field to a named secret:

```typescript theme={null}
await rt.tools.execute('my-api-tool', {
  action: 'lookup',
  params: { id: 'cus_123' },
  credentialOverrides: {
    apiKey: 'CUSTOMER_API_KEY',
  },
});
```

## Custom Tools

```typescript theme={null}
const customTools = await rt.tools.custom();
await rt.tools.setVisibility('customer-api', 'org');
```

Build custom tools with `defineTool()` and deploy them with the CLI. See [Custom Tools](/sdk/custom-tools).

## Methods

| Method                                | Description                                              |
| ------------------------------------- | -------------------------------------------------------- |
| `marketplace({ category? })`          | List public marketplace tools                            |
| `search(query)`                       | Search public tools                                      |
| `get(slug)`                           | Get marketplace metadata                                 |
| `list({ all? })`                      | List installed tools                                     |
| `custom({ all? })`                    | List visible custom tools                                |
| `install(slug)`                       | Install a tool                                           |
| `uninstall(slug)`                     | Uninstall a tool                                         |
| `forceUninstall(slug)`                | Admin-only removal across the org                        |
| `setVisibility(slug, visibility)`     | Set custom tool visibility                               |
| `storeCredentials(slug, credentials)` | Store manual credentials                                 |
| `credentials(slug)`                   | Check credential status                                  |
| `clearCredentials(slug)`              | Clear manual credentials                                 |
| `execute(slug, options)`              | Run a tool action                                        |
| `schemas()`                           | Prefetch JSON schemas for marketplace tools              |
| `activity(slug, options?)`            | Read a tool's execution activity (`{ limit?, cursor? }`) |
