@raindrop-ai/tanstack-ai adds Raindrop to TanStack AI chat() via a ChatMiddleware. It captures each chat invocation as a Raindrop event plus an OTel trace, and uses TanStack threadId to keep multi-turn chats grouped together.
Install
Quick start
Configuration
createRaindropTanstackAI() accepts the public options exported by the package:
For multi-project organizations, create one client per project and pass each
project’s slug as
projectId. Omit projectId to use the organization’s
default project.
Per-call overrides go on TanStack AI’s context object:
eventId / event_id override the generated event ID for that request. When convoId is omitted, the middleware falls back to TanStack AI’s threadId.
What gets captured
- One Raindrop event per
chat()call - One trace per
chat()call - Message content and system prompts when
captureContentis left on - Tool calls and tool results
- Per-call metadata from
context.properties
Tool catalog capture (ai.prompt.tools)
Every model call’s span records the tools the engine handed the adapter for that call as ai.prompt.tools (TanStack inputSchemas are converted with convertSchemaToJsonSchema). This is exact per-call capture; captureContent: false suppresses it with the rest of the prompt. Pass tools in the middleware options to record a different list instead (it replaces the inferred one; tools: [] records an empty catalog). See Tool catalog capture for the attribute format, the absent / [] semantics and the override shapes accepted.
Known limitations
- TanStack AI does not expose a public attachment channel on the
chat()capture path yet, so attachments are not captured here. - Capture currently ships through the partial-event route, so the event is emitted first and finalized by patching the partial record.
Application Git identity
In ordinary Node.js runtimes,createRaindropTanstackAI discovers a reliable application SHA in the
background. Use appGit for commitSha, commitDirty, branch, sourceDirectory, detectBranch,
or autoDetect; browser builds require explicit build injection. See the
TypeScript Git reference.