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

# Connections, secrets, and tools

> Reference connections and secrets from @trytilde/iac specs, pick tools with typed names, and fix what preflight reports.

Connections and secrets hold credentials, so a spec never creates them. You set them up once in Tilde, and the spec references them by name. Everything else in a spec is created and updated by the apply.

## Connections

Reference a connection by its `provider/name` slug:

```ts theme={"system"}
import { connection, github, openai } from "@trytilde/iac";

github.ref("acme");                         // the connection github/acme, typed
github.ref("acme", { type: "github_app" }); // and require its connection type
openai.ref("production");                   // openai/production
connection.ref("acme_mcp/prod");            // any connection, untyped
```

Every built-in provider has a typed ref, such as `github`, `slack`, `linear`, `openai`, `e2b`, or `modal`. Use `connection.ref` for anything else, such as an MCP server or a Tilde tool server.

## Secrets

A secret is a named value in **Connections → Secrets**. Reference it with `secret.ref`, for example in a sandbox blueprint's environment. Its value never enters your code.

```ts theme={"system"}
import { blueprint, e2b, secret } from "@trytilde/iac";

export const sandbox = blueprint({
  name: "triage-sandbox",
  provider: e2b.ref("default"),
  template: "acme-node",
  env: { NODE_ENV: "production", NPM_TOKEN: secret.ref("NPM_TOKEN") },
});
```

Literal values live in your code, so never put a credential in one. Ontology environments bind secrets the same way. See [Bind connections and secrets](https://trytilde.ai/docs/ontology/deploying.md#bind-connections-and-secrets).

## When something is missing

Preflight lists every problem at once, before anything changes. Each comes with a link:

```text theme={"system"}
Blocked: 2 action(s) needed before anything is applied
  ✗ triage/tools/github/acme: Connection github/acme does not exist; create it, named acme
      → https://<your-tilde-url>/registry/tools/catalog/github?name=acme
  ✗ sandbox triage-sandbox/env/NPM_TOKEN: Secret NPM_TOKEN does not exist; add it in Connections → Secrets
      → https://<your-tilde-url>/connections/secrets?add=NPM_TOKEN
```

* A missing connection links to its setup page, with the provider, name, and type filled in.
* A missing secret opens the Secrets page with a new row, the key filled in.
* A connection that is not ready, or offers no tool you name, is reported the same way.

Fix each one, then run `tilde deploy` again.

## Tools

Select a connection's tools with `.tools()`. On a typed ref, the tool names are a closed list from Tilde's catalog, so a misspelt name does not compile.

```ts theme={"system"}
import { ALL, connection, github } from "@trytilde/iac";

tools: [
  github.ref("acme").tools("github_get_issue", "github_add_issue_comment"),
  github.ref("docs").tools(ALL),                       // every tool, now and later. "*" is the same
  github.ref("acme").untypedTools("github_new_tool"),  // a name newer than your package
  connection.ref("acme_mcp/prod").tools("search"),     // untyped: any string
]
```

* `ALL`, or `"*"`, selects every tool the connection offers when the apply runs.
* `.untypedTools()` takes any name, and combines with `.tools()` in any order. Upgrade `@trytilde/iac` to get newer catalog names typed.
* Tilde checks every name in preflight, and suggests the nearest: "did you mean `github_get_issue`?".
* A tool source ends up with exactly the tools you list.

### Type your own connections

`tilde iac types` reads your organization's connections, including MCP servers, tool servers, and ontology environments, and writes a `.d.ts`. Then `connection.ref("acme_mcp/prod")` is typed with that connection's real tool names.

```bash theme={"system"}
tilde iac types --out tilde-connections.d.ts
```

Include the file in your `tsconfig.json`, and run the command again when a connection's tools change.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.