Status: Published
Last Updated: 2025-08-10
Category: Technical Reference
This section provides detailed technical reference documentation for Thea Code's advanced features, protocols, and components.
Comprehensive documentation of the MCP system
Reference for built-in and custom tools
Webview and UI component reference
interface McpTool {
name: string;
description: string;
inputSchema: {
type: "object";
properties: Record<string, any>;
required?: string[];
};
}interface WebviewMessage {
type: string;
payload?: any;
id?: string;
timestamp?: number;
}interface ApiHandler {
createMessage(params: CreateMessageParams): AsyncGenerator<ApiStreamChunk>;
getModel(): string;
getMaxTokens(): number;
}graph TD
A[User Request] --> B[Thea Task]
B --> C[Tool Detection]
C --> D{Tool Type?}
D -->|Built-in| E[Native Tool Handler]
D -->|MCP| F[MCP Router]
F --> G[MCP Client]
G --> H[MCP Server]
H --> I[Tool Execution]
I --> J[Tool Result]
J --> B
sequenceDiagram
participant U as User
participant W as Webview
participant E as Extension
participant P as Provider
U->>W: User Input
W->>E: Send Message
E->>P: API Request
P-->>E: Stream Response
E-->>W: Update UI
W-->>U: Display Result
{
"thea.apiProvider": "anthropic",
"thea.apiKey": "sk-...",
"thea.apiModel": "claude-3-opus",
"thea.apiBaseUrl": "https://api.anthropic.com"
}{
"thea.mcpServers": {
"filesystem": {
"command": "node",
"args": ["@modelcontextprotocol/server-filesystem"],
"env": {
"ALLOWED_PATHS": "/workspace"
}
}
}
}{
"thea.customModes": [
{
"name": "architect",
"instructions": "You are a system architect...",
"tools": ["read-file", "search-files"],
"temperature": 0.3
}
]
}interface NeutralMessage {
role: "user" | "assistant" | "system";
content: string | ContentBlock[];
tool_calls?: ToolCall[];
tool_result?: ToolResult;
}
interface ContentBlock {
type: "text" | "image" | "tool_use" | "tool_result";
text?: string;
image?: ImageBlock;
tool_use?: ToolUseBlock;
tool_result?: ToolResultBlock;
}type ApiStreamChunk =
| ApiStreamTextChunk
| ApiStreamToolUseChunk
| ApiStreamToolResultChunk
| ApiStreamUsageChunk
| ApiStreamReasoningChunk;
interface ApiStreamTextChunk {
type: "text";
content: string;
}
interface ApiStreamToolUseChunk {
type: "tool_use";
tool: ToolUse;
}| Operation | Target | Maximum |
|---|---|---|
| Tool Registration | <100ms | 500ms |
| Message Routing | <50ms | 200ms |
| Stream Start | <1s | 3s |
| Tool Execution | <5s | 30s |
| Component | Limit | Notes |
|---|---|---|
| Context Window | Model-dependent | 8k-200k tokens |
| File Cache | 100MB | Per workspace |
| History | 50 tasks | Configurable |
| Tool Results | 10MB | Per execution |
- Stored in VSCode SecretStorage
- Never logged or transmitted in plain text
- Scoped per workspace
- Limited to workspace directory
- Respects .gitignore and .theaignore
- No access to system files
- Sandboxed environment
- User approval required for destructive operations
- Audit log maintained
interface SseMessage {
event?: string;
data: string;
id?: string;
retry?: number;
}interface StdioMessage {
jsonrpc: "2.0";
method?: string;
params?: any;
result?: any;
error?: any;
id?: string | number;
}| Code | Description | Resolution |
|---|---|---|
| E001 | API key missing | Configure API key in settings |
| E002 | Invalid model | Check supported models |
| E003 | Rate limit exceeded | Wait and retry |
| E004 | Context limit exceeded | Reduce input size |
| E005 | Tool execution failed | Check tool configuration |
| E006 | MCP server unreachable | Verify server is running |
| Event | Description | Data |
|---|---|---|
| task.start | New task initiated | Provider, model |
| task.complete | Task finished | Duration, tokens |
| tool.execute | Tool executed | Tool name, success |
| error.api | API error occurred | Error code, provider |
- MCP - Model Context Protocol, standardized tool interface
- Neutral Format - Provider-agnostic message format
- SSE - Server-Sent Events, streaming protocol
- STDIO - Standard Input/Output, process communication
- Tool - Executable function available to the AI
- Provider - API service (Anthropic, OpenAI, etc.)
- Mode - Behavioral configuration for the assistant
| Thea Version | VSCode | Node.js | MCP SDK |
|---|---|---|---|
| 1.0.0+ | 1.85.0+ | 18.0+ | 0.1.0+ |
Need more technical details? Check the source code or ask in our Discord #development channel.