corsairTools turns a Corsair instance into LlamaIndex.TS tools, one tool per API operation. Hand them to agent({ tools }) and the model can call Slack, GitHub, Gmail, Linear, Stripe, and the rest of the plugin catalog.
The credentials never leave your database. Corsair runs OAuth server-side, stores the encrypted tokens under your own key, and the tool call reads them at execution time. The model sees tool names and results, never a token.
Install
@corsair-dev/* package per service you connect:
@llamaindex/core is a peer dependency. npm marks it deprecated as a standalone install, but it stays the correct peer for LlamaIndex.TS tooling: the llamaindex meta-package itself depends on @llamaindex/core, and it exposes the tool API this adapter builds on. The adapter imports it lazily, so installing @corsair-dev/llamaindex alone never pulls LlamaIndex into a project that does not use this entrypoint.Quickstart
1
Create the Corsair instance
Build it once and reuse it.
authType: 'managed' lets Corsair hold the OAuth connection; the tokens stay encrypted in your database under your kek.corsair.ts
2
Build the tools
corsairTools is async. It returns one LlamaIndex tool per operation, ready for any agent.3
Give them to an agent
agent.ts
Choosing which tools
Scope the toolset so the model only sees what the task needs. Fewer tools means cleaner prompts and fewer wrong turns.Multi-tenancy
On a multi-tenant instance, pin the tenant whose stored credentials the tools should use. Each tenant owns its own connections, so the same code serves every user:tenantId.
API
CorsairInstance
required
The value from
createCorsair() (or corsair.withTenant(...)).string
Include every operation of one plugin. Omit
plugin and operations to include all registered plugins.string[]
Include only these operation paths, e.g.
slack.api.channels.list.string
Use the stored credentials of this tenant. Ignored on single-tenant instances.
Notes
- Tool names. The operation path becomes the tool name with
.replaced by_(slack.api.channels.listbecomesslack_api_channels_list), so it satisfies the model’s function-name constraint. - Schemas. Corsair is on Zod v4, which
@llamaindex/coreaccepts directly as a tool’sparameters. The adapter parses model-generated args through the schema before the operation runs, so invalid input is rejected early. - Results. String results pass through; anything else is JSON-encoded into the tool output the model reads.