Skip to content

Phase 7: TUI + MCP Client for tri-api #66

@gHashTag

Description

@gHashTag

Summary

Interactive terminal (TUI) + MCP stdio client for tri-api.

7A: TUI (~200 LOC)

src/tri-api/tui.zig — ANSI colored output, prompt input, streaming chars, status bar.

tri-api                        # No args → interactive TUI mode
tri-api "one-shot prompt"      # With args → batch mode (unchanged)

Interactive: tri> prompt, colored tool/assistant output, /quit to exit.

7B: MCP Client (~150 LOC)

src/tri-api/mcp_client.zig — stdio subprocess transport, JSON-RPC 2.0.

Config in .tri-api/settings.json:

{
  "mcp_servers": {
    "trinity": { "command": ["./zig-out/bin/trinity-mcp"] }
  }
}

On startup: spawn servers → listTools() → merge into Anthropic tool_definitions.

Files

File Action LOC
src/tri-api/tui.zig NEW ~200
src/tri-api/mcp_client.zig NEW ~150
src/tri-api/main.zig MOD ~+60
src/tri-api/tool_executor.zig MOD ~+30

Acceptance Criteria

  • tri-api with no args enters interactive TUI mode
  • ANSI colored output (cyan assistant, yellow tool, red error)
  • MCP servers spawn from settings.json config
  • MCP tools merged into Anthropic API tool_definitions
  • MCP tool_use calls routed to mcp_client.callTool()
  • zig build clean

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions