blob: 522511b382ac6bc7b16f743943b3b7fe021af0c1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
|
/**
* Shared types for the MCP extension.
*/
import type { ToolParameterSchema } from "@dispatch/kernel";
export interface McpServerConfig {
readonly command: string;
readonly args?: readonly string[];
readonly env?: Readonly<Record<string, string>>;
}
export interface ResolvedMcpServer {
readonly id: string;
readonly command: readonly string[];
readonly env?: Readonly<Record<string, string>>;
readonly configSource: ".dispatch/mcp.json" | "opencode.json";
}
export interface ResolveResult {
readonly servers: readonly ResolvedMcpServer[];
readonly shadowed: boolean;
}
export type McpServerState = "connecting" | "connected" | "error" | "disconnected";
export interface McpServerStatus {
readonly id: string;
readonly state: McpServerState;
readonly error?: string;
readonly toolCount: number;
}
export interface McpToolInfo {
readonly name: string;
readonly description: string;
readonly inputSchema: ToolParameterSchema;
}
export interface McpContentItem {
readonly type: string;
readonly text?: string;
readonly data?: string;
readonly mimeType?: string;
readonly resource?: {
readonly uri: string;
readonly text?: string;
};
}
export interface McpCallResult {
readonly content: readonly McpContentItem[];
readonly isError?: boolean;
}
export interface McpServerCapabilities {
readonly tools?: {
readonly listChanged?: boolean;
};
}
export interface McpInitializeResult {
readonly protocolVersion: string;
readonly capabilities: McpServerCapabilities;
readonly serverInfo: {
readonly name: string;
readonly version: string;
};
}
export interface McpService {
readonly status: (cwd: string) => Promise<readonly McpServerStatus[]>;
}
export interface McpListToolsResult {
readonly tools: readonly McpToolInfo[];
}
/**
* The narrow capability `adaptTool` depends on: the ability to invoke a tool
* on the MCP server. Declared as a port so the registry stays pure and
* testable against a real collaborator (not a mock of `McpClient`).
* `McpClient` satisfies this structurally.
*/
export interface McpToolCaller {
readonly callTool: (name: string, args: unknown, signal?: AbortSignal) => Promise<McpCallResult>;
}
|