Skip to content

feat: add integration tools abstraction and TrustFoundry legal research#169

Open
iamgroot2285 wants to merge 2 commits into
willchen96:mainfrom
trustfoundry-ai:feat/trustfoundry-integration
Open

feat: add integration tools abstraction and TrustFoundry legal research#169
iamgroot2285 wants to merge 2 commits into
willchen96:mainfrom
trustfoundry-ai:feat/trustfoundry-integration

Conversation

@iamgroot2285

@iamgroot2285 iamgroot2285 commented Jun 5, 2026

Copy link
Copy Markdown

Summary

  • Add ToolIntegration interface for plugging external tool providers into assistant chat.
    The current design targets integrations backed by API keys; providers requiring OAuth or
    per-user token management would need additional key-storage infrastructure.
  • Surface integration tool display names in SSE tool_call_start events so the frontend
    shows user-friendly labels (e.g. "Running TrustFoundry Legal Research...") — display
    names are defined per-provider, keeping everything encapsulated in a single module
  • Return explicit error results for unrecognized tool calls instead of silently dropping them
  • Add docs/integrations.md documenting optional third-party integration setup
  • Implement TrustFoundry as the first integration: legal search, citation validation,
    and usage tools

Why

Mike's chat tools were hardcoded — no way to add external tool providers without editing
chatTools.ts directly. The ToolIntegration abstraction lets new providers be added as
self-contained modules with their own tool definitions, display names, and execution logic.

Test

  • npm run build --prefix backend
  • npm run build --prefix frontend
  • Verified TrustFoundry tools appear in chat when TRUSTFOUNDRY_ENABLED=true and
    TRUSTFOUNDRY_API_KEY are set; hidden when disabled

@iamgroot2285 iamgroot2285 marked this pull request as ready for review June 5, 2026 01:59
Introduce a pluggable ToolIntegration interface that allows external legal
research providers to register tools alongside Mike's built-in document and
workflow tools. Each integration declares its own tool schemas, a
user-facing display name, and a stateless run() handler — keeping
provider-specific logic fully encapsulated outside of chatTools.ts.

TrustFoundry is included as the first integration (disabled by default).
When enabled via TRUSTFOUNDRY_API_KEY and TRUSTFOUNDRY_ENABLED, it exposes
agentic and direct legal search across cases, statutes, and regulations,
plus citation validation and authority summaries.

Backend changes:
- New backend/src/lib/integrations/ module with ToolIntegration type,
  registry, and TrustFoundry implementation
- chatTools.ts: merge integration tools into the active tool list,
  dispatch unrecognized tool calls through the integration registry,
  and emit displayName on tool_call_start SSE events

Frontend changes:
- Add optional displayName field to tool_call_start in AssistantEvent type
- Pass displayName through SSE parser in useAssistantChat
- Use displayName in toolCallLabel() for friendly UI labels
  (e.g. "Running TrustFoundry Legal Research...")

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@iamgroot2285 iamgroot2285 force-pushed the feat/trustfoundry-integration branch from 23f2c10 to f6e4a58 Compare June 13, 2026 14:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant