@elizaos/plugin-mcp 1.0.8 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/dist/actions/callToolAction.d.ts +3 -0
- package/dist/actions/callToolAction.d.ts.map +1 -0
- package/dist/actions/readResourceAction.d.ts +3 -0
- package/dist/actions/readResourceAction.d.ts.map +1 -0
- package/dist/cjs/index.cjs +2214 -0
- package/dist/cjs/index.js.map +33 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1981 -563
- package/dist/index.js.map +33 -0
- package/dist/provider.d.ts +3 -0
- package/dist/provider.d.ts.map +1 -0
- package/dist/service.d.ts +41 -0
- package/dist/service.d.ts.map +1 -0
- package/dist/templates/errorAnalysisPrompt.d.ts +2 -0
- package/dist/templates/errorAnalysisPrompt.d.ts.map +1 -0
- package/dist/templates/feedbackTemplate.d.ts +2 -0
- package/dist/templates/feedbackTemplate.d.ts.map +1 -0
- package/dist/templates/resourceAnalysisTemplate.d.ts +2 -0
- package/dist/templates/resourceAnalysisTemplate.d.ts.map +1 -0
- package/dist/templates/resourceSelectionTemplate.d.ts +2 -0
- package/dist/templates/resourceSelectionTemplate.d.ts.map +1 -0
- package/dist/templates/toolReasoningTemplate.d.ts +2 -0
- package/dist/templates/toolReasoningTemplate.d.ts.map +1 -0
- package/dist/templates/toolSelectionTemplate.d.ts +3 -0
- package/dist/templates/toolSelectionTemplate.d.ts.map +1 -0
- package/dist/tool-compatibility/index.d.ts +54 -0
- package/dist/tool-compatibility/index.d.ts.map +1 -0
- package/dist/tool-compatibility/providers/anthropic.d.ts +12 -0
- package/dist/tool-compatibility/providers/anthropic.d.ts.map +1 -0
- package/dist/tool-compatibility/providers/google.d.ts +12 -0
- package/dist/tool-compatibility/providers/google.d.ts.map +1 -0
- package/dist/tool-compatibility/providers/openai.d.ts +20 -0
- package/dist/tool-compatibility/providers/openai.d.ts.map +1 -0
- package/dist/types.d.ts +165 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/utils/error.d.ts +14 -0
- package/dist/utils/error.d.ts.map +1 -0
- package/dist/utils/handler.d.ts +3 -0
- package/dist/utils/handler.d.ts.map +1 -0
- package/dist/utils/json.d.ts +9 -0
- package/dist/utils/json.d.ts.map +1 -0
- package/dist/utils/mcp.d.ts +5 -0
- package/dist/utils/mcp.d.ts.map +1 -0
- package/dist/utils/processing.d.ts +43 -0
- package/dist/utils/processing.d.ts.map +1 -0
- package/dist/utils/schemas.d.ts +69 -0
- package/dist/utils/schemas.d.ts.map +1 -0
- package/dist/utils/selection.d.ts +38 -0
- package/dist/utils/selection.d.ts.map +1 -0
- package/dist/utils/validation.d.ts +34 -0
- package/dist/utils/validation.d.ts.map +1 -0
- package/dist/utils/wrapper.d.ts +27 -0
- package/dist/utils/wrapper.d.ts.map +1 -0
- package/package.json +30 -7
- package/.github/workflows/npm-deploy.yml +0 -112
- package/.npmrc.template +0 -2
- package/biome.json +0 -34
- package/images/banner.jpg +0 -0
- package/images/logo.jpg +0 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { McpToolCompatibility, type ModelInfo } from '../index';
|
|
2
|
+
export declare class GoogleMcpCompatibility extends McpToolCompatibility {
|
|
3
|
+
constructor(modelInfo: ModelInfo);
|
|
4
|
+
shouldApply(): boolean;
|
|
5
|
+
protected getUnsupportedStringProperties(): string[];
|
|
6
|
+
protected getUnsupportedNumberProperties(): string[];
|
|
7
|
+
protected getUnsupportedArrayProperties(): string[];
|
|
8
|
+
protected getUnsupportedObjectProperties(): string[];
|
|
9
|
+
protected mergeDescription(originalDescription: string | undefined, constraints: any): string;
|
|
10
|
+
private formatConstraintsForGoogle;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=google.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"google.d.ts","sourceRoot":"","sources":["../../../src/tool-compatibility/providers/google.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,KAAK,SAAS,EAAE,MAAM,UAAU,CAAC;AAEhE,qBAAa,sBAAuB,SAAQ,oBAAoB;gBAClD,SAAS,EAAE,SAAS;IAIhC,WAAW,IAAI,OAAO;IAMtB,SAAS,CAAC,8BAA8B,IAAI,MAAM,EAAE;IAMpD,SAAS,CAAC,8BAA8B,IAAI,MAAM,EAAE;IAKpD,SAAS,CAAC,6BAA6B,IAAI,MAAM,EAAE;IAKnD,SAAS,CAAC,8BAA8B,IAAI,MAAM,EAAE;IAMpD,SAAS,CAAC,gBAAgB,CAAC,mBAAmB,EAAE,MAAM,GAAG,SAAS,EAAE,WAAW,EAAE,GAAG,GAAG,MAAM;IAU7F,OAAO,CAAC,0BAA0B;CAgEnC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { McpToolCompatibility, type ModelInfo } from '../index';
|
|
2
|
+
export declare class OpenAIMcpCompatibility extends McpToolCompatibility {
|
|
3
|
+
constructor(modelInfo: ModelInfo);
|
|
4
|
+
shouldApply(): boolean;
|
|
5
|
+
protected getUnsupportedStringProperties(): string[];
|
|
6
|
+
protected getUnsupportedNumberProperties(): string[];
|
|
7
|
+
protected getUnsupportedArrayProperties(): string[];
|
|
8
|
+
protected getUnsupportedObjectProperties(): string[];
|
|
9
|
+
}
|
|
10
|
+
export declare class OpenAIReasoningMcpCompatibility extends McpToolCompatibility {
|
|
11
|
+
constructor(modelInfo: ModelInfo);
|
|
12
|
+
shouldApply(): boolean;
|
|
13
|
+
protected getUnsupportedStringProperties(): string[];
|
|
14
|
+
protected getUnsupportedNumberProperties(): string[];
|
|
15
|
+
protected getUnsupportedArrayProperties(): string[];
|
|
16
|
+
protected getUnsupportedObjectProperties(): string[];
|
|
17
|
+
protected mergeDescription(originalDescription: string | undefined, constraints: any): string;
|
|
18
|
+
private formatConstraintsForReasoningModel;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=openai.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"openai.d.ts","sourceRoot":"","sources":["../../../src/tool-compatibility/providers/openai.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,KAAK,SAAS,EAAE,MAAM,UAAU,CAAC;AAEhE,qBAAa,sBAAuB,SAAQ,oBAAoB;gBAClD,SAAS,EAAE,SAAS;IAIhC,WAAW,IAAI,OAAO;IAStB,SAAS,CAAC,8BAA8B,IAAI,MAAM,EAAE;IAgBpD,SAAS,CAAC,8BAA8B,IAAI,MAAM,EAAE;IAUpD,SAAS,CAAC,6BAA6B,IAAI,MAAM,EAAE;IASnD,SAAS,CAAC,8BAA8B,IAAI,MAAM,EAAE;CAIrD;AAED,qBAAa,+BAAgC,SAAQ,oBAAoB;gBAC3D,SAAS,EAAE,SAAS;IAIhC,WAAW,IAAI,OAAO;IAOtB,SAAS,CAAC,8BAA8B,IAAI,MAAM,EAAE;IAKpD,SAAS,CAAC,8BAA8B,IAAI,MAAM,EAAE;IAKpD,SAAS,CAAC,6BAA6B,IAAI,MAAM,EAAE;IAKnD,SAAS,CAAC,8BAA8B,IAAI,MAAM,EAAE;IAMpD,SAAS,CAAC,gBAAgB,CAAC,mBAAmB,EAAE,MAAM,GAAG,SAAS,EAAE,WAAW,EAAE,GAAG,GAAG,MAAM;IAQ7F,OAAO,CAAC,kCAAkC;CAuC3C"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import type { Client } from "@modelcontextprotocol/sdk/client/index.js";
|
|
2
|
+
import type { SSEClientTransport } from "@modelcontextprotocol/sdk/client/sse.js";
|
|
3
|
+
import type { StdioClientTransport } from "@modelcontextprotocol/sdk/client/stdio.js";
|
|
4
|
+
import type { EmbeddedResource, ImageContent, Resource, ResourceTemplate, TextContent, Tool } from "@modelcontextprotocol/sdk/types.js";
|
|
5
|
+
export declare const MCP_SERVICE_NAME = "mcp";
|
|
6
|
+
export declare const DEFAULT_MCP_TIMEOUT_SECONDS = 60000;
|
|
7
|
+
export declare const MIN_MCP_TIMEOUT_SECONDS = 1;
|
|
8
|
+
export declare const DEFAULT_MAX_RETRIES = 2;
|
|
9
|
+
export interface PingConfig {
|
|
10
|
+
enabled: boolean;
|
|
11
|
+
intervalMs: number;
|
|
12
|
+
timeoutMs: number;
|
|
13
|
+
failuresBeforeDisconnect: number;
|
|
14
|
+
}
|
|
15
|
+
export interface ConnectionState {
|
|
16
|
+
status: "connecting" | "connected" | "disconnected" | "failed";
|
|
17
|
+
pingInterval?: NodeJS.Timer;
|
|
18
|
+
reconnectTimeout?: NodeJS.Timer;
|
|
19
|
+
reconnectAttempts: number;
|
|
20
|
+
lastConnected?: Date;
|
|
21
|
+
lastError?: Error;
|
|
22
|
+
consecutivePingFailures: number;
|
|
23
|
+
}
|
|
24
|
+
export type StdioMcpServerConfig = {
|
|
25
|
+
type: "stdio";
|
|
26
|
+
command?: string;
|
|
27
|
+
args?: string[];
|
|
28
|
+
env?: Record<string, string>;
|
|
29
|
+
cwd?: string;
|
|
30
|
+
timeoutInMillis?: number;
|
|
31
|
+
};
|
|
32
|
+
export type HttpMcpServerConfig = {
|
|
33
|
+
type: "http" | "streamable-http" | "sse";
|
|
34
|
+
url: string;
|
|
35
|
+
timeout?: number;
|
|
36
|
+
};
|
|
37
|
+
export type McpServerConfig = StdioMcpServerConfig | HttpMcpServerConfig;
|
|
38
|
+
export type McpSettings = {
|
|
39
|
+
servers: Record<string, McpServerConfig>;
|
|
40
|
+
maxRetries?: number;
|
|
41
|
+
};
|
|
42
|
+
export type McpServerStatus = "connecting" | "connected" | "disconnected";
|
|
43
|
+
export interface McpServer {
|
|
44
|
+
name: string;
|
|
45
|
+
status: McpServerStatus;
|
|
46
|
+
config: string;
|
|
47
|
+
error?: string;
|
|
48
|
+
disabled?: boolean;
|
|
49
|
+
tools?: Tool[];
|
|
50
|
+
resources?: Resource[];
|
|
51
|
+
resourceTemplates?: ResourceTemplate[];
|
|
52
|
+
}
|
|
53
|
+
export interface McpConnection {
|
|
54
|
+
server: McpServer;
|
|
55
|
+
client: Client;
|
|
56
|
+
transport: StdioClientTransport | SSEClientTransport;
|
|
57
|
+
}
|
|
58
|
+
export interface McpToolResult {
|
|
59
|
+
content: Array<TextContent | ImageContent | EmbeddedResource>;
|
|
60
|
+
isError?: boolean;
|
|
61
|
+
}
|
|
62
|
+
export interface McpToolCallResponse {
|
|
63
|
+
content: Array<TextContent | ImageContent | EmbeddedResource>;
|
|
64
|
+
isError?: boolean;
|
|
65
|
+
}
|
|
66
|
+
export interface McpResourceResponse {
|
|
67
|
+
contents: Array<{
|
|
68
|
+
uri: string;
|
|
69
|
+
mimeType?: string;
|
|
70
|
+
text?: string;
|
|
71
|
+
blob?: string;
|
|
72
|
+
}>;
|
|
73
|
+
}
|
|
74
|
+
export interface McpToolInfo {
|
|
75
|
+
description: string;
|
|
76
|
+
inputSchema?: {
|
|
77
|
+
properties?: Record<string, unknown>;
|
|
78
|
+
required?: string[];
|
|
79
|
+
[key: string]: unknown;
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
export interface McpResourceInfo {
|
|
83
|
+
name: string;
|
|
84
|
+
description: string;
|
|
85
|
+
mimeType?: string;
|
|
86
|
+
}
|
|
87
|
+
export interface McpServerInfo {
|
|
88
|
+
status: string;
|
|
89
|
+
tools: Record<string, McpToolInfo>;
|
|
90
|
+
resources: Record<string, McpResourceInfo>;
|
|
91
|
+
}
|
|
92
|
+
export type McpProvider = {
|
|
93
|
+
values: {
|
|
94
|
+
mcp: McpProviderData;
|
|
95
|
+
};
|
|
96
|
+
data: {
|
|
97
|
+
mcp: McpProviderData;
|
|
98
|
+
};
|
|
99
|
+
text: string;
|
|
100
|
+
};
|
|
101
|
+
export interface McpProviderData {
|
|
102
|
+
[serverName: string]: McpServerInfo;
|
|
103
|
+
}
|
|
104
|
+
export declare const ToolSelectionSchema: {
|
|
105
|
+
type: string;
|
|
106
|
+
required: string[];
|
|
107
|
+
properties: {
|
|
108
|
+
serverName: {
|
|
109
|
+
type: string;
|
|
110
|
+
minLength: number;
|
|
111
|
+
errorMessage: string;
|
|
112
|
+
};
|
|
113
|
+
toolName: {
|
|
114
|
+
type: string;
|
|
115
|
+
minLength: number;
|
|
116
|
+
errorMessage: string;
|
|
117
|
+
};
|
|
118
|
+
arguments: {
|
|
119
|
+
type: string;
|
|
120
|
+
};
|
|
121
|
+
reasoning: {
|
|
122
|
+
type: string;
|
|
123
|
+
};
|
|
124
|
+
noToolAvailable: {
|
|
125
|
+
type: string;
|
|
126
|
+
};
|
|
127
|
+
};
|
|
128
|
+
};
|
|
129
|
+
export declare const ResourceSelectionSchema: {
|
|
130
|
+
type: string;
|
|
131
|
+
required: string[];
|
|
132
|
+
properties: {
|
|
133
|
+
serverName: {
|
|
134
|
+
type: string;
|
|
135
|
+
minLength: number;
|
|
136
|
+
errorMessage: string;
|
|
137
|
+
};
|
|
138
|
+
uri: {
|
|
139
|
+
type: string;
|
|
140
|
+
minLength: number;
|
|
141
|
+
errorMessage: string;
|
|
142
|
+
};
|
|
143
|
+
reasoning: {
|
|
144
|
+
type: string;
|
|
145
|
+
};
|
|
146
|
+
noResourceAvailable: {
|
|
147
|
+
type: string;
|
|
148
|
+
};
|
|
149
|
+
};
|
|
150
|
+
};
|
|
151
|
+
export declare const DEFAULT_PING_CONFIG: PingConfig;
|
|
152
|
+
export declare const MAX_RECONNECT_ATTEMPTS = 5;
|
|
153
|
+
export declare const BACKOFF_MULTIPLIER = 2;
|
|
154
|
+
export declare const INITIAL_RETRY_DELAY = 2000;
|
|
155
|
+
interface SuccessResult<T> {
|
|
156
|
+
success: true;
|
|
157
|
+
data: T;
|
|
158
|
+
}
|
|
159
|
+
interface ErrorResult {
|
|
160
|
+
success: false;
|
|
161
|
+
error: string;
|
|
162
|
+
}
|
|
163
|
+
export type ValidationResult<T> = SuccessResult<T> | ErrorResult;
|
|
164
|
+
export {};
|
|
165
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 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E,UAKjC,CAAC;AAEF,eAAO,MAAM,sBAAsB,IAAI,CAAC;AACxC,eAAO,MAAM,kBAAkB,IAAI,CAAC;AACpC,eAAO,MAAM,mBAAmB,OAAO,CAAC;AAExC,UAAU,aAAa,CAAC,CAAC;IACvB,OAAO,EAAE,IAAI,CAAC;IACd,IAAI,EAAE,CAAC,CAAC;CACT;AAED,UAAU,WAAW;IACnB,OAAO,EAAE,KAAK,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,MAAM,gBAAgB,CAAC,CAAC,IAAI,aAAa,CAAC,CAAC,CAAC,GAAG,WAAW,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type HandlerCallback, type IAgentRuntime, type Memory, type ActionResult } from '@elizaos/core';
|
|
2
|
+
import type { State } from '@elizaos/core';
|
|
3
|
+
import type { McpProvider } from '../types';
|
|
4
|
+
export declare function handleMcpError(state: State, mcpProvider: McpProvider, error: unknown, runtime: IAgentRuntime, message: Memory, type: 'tool' | 'resource', callback?: HandlerCallback): Promise<ActionResult>;
|
|
5
|
+
export declare class McpError extends Error {
|
|
6
|
+
readonly code: string;
|
|
7
|
+
constructor(message: string, code?: string);
|
|
8
|
+
static connectionError(serverName: string, details?: string): McpError;
|
|
9
|
+
static toolNotFound(toolName: string, serverName: string): McpError;
|
|
10
|
+
static resourceNotFound(uri: string, serverName: string): McpError;
|
|
11
|
+
static validationError(details: string): McpError;
|
|
12
|
+
static serverError(serverName: string, details?: string): McpError;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=error.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../../src/utils/error.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,KAAK,MAAM,EAIX,KAAK,YAAY,EAClB,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EAAE,KAAK,EAAE,MAA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export declare function parseJSON<T>(input: string): T;
|
|
2
|
+
export declare function validateJsonSchema<T = unknown>(data: unknown, schema: Record<string, unknown>): {
|
|
3
|
+
success: true;
|
|
4
|
+
data: T;
|
|
5
|
+
} | {
|
|
6
|
+
success: false;
|
|
7
|
+
error: string;
|
|
8
|
+
};
|
|
9
|
+
//# sourceMappingURL=json.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"json.d.ts","sourceRoot":"","sources":["../../src/utils/json.ts"],"names":[],"mappings":"AAGA,wBAAgB,SAAS,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,GAAG,CAAC,CAc7C;AAOD,wBAAgB,kBAAkB,CAAC,CAAC,GAAG,OAAO,EAC5C,IAAI,EAAE,OAAO,EACb,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC9B;IAAE,OAAO,EAAE,IAAI,CAAC;IAAC,IAAI,EAAE,CAAC,CAAA;CAAE,GAAG;IAAE,OAAO,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAqBhE"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { IAgentRuntime, Memory } from "@elizaos/core";
|
|
2
|
+
import type { McpProvider, McpServer } from "../types";
|
|
3
|
+
export declare function createMcpMemory(runtime: IAgentRuntime, message: Memory, type: string, serverName: string, content: string, metadata: Record<string, unknown>): Promise<void>;
|
|
4
|
+
export declare function buildMcpProviderData(servers: McpServer[]): McpProvider;
|
|
5
|
+
//# sourceMappingURL=mcp.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp.d.ts","sourceRoot":"","sources":["../../src/utils/mcp.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAC3D,OAAO,KAAK,EACV,WAAW,EAGX,SAAS,EAEV,MAAM,UAAU,CAAC;AAElB,wBAAsB,eAAe,CACnC,OAAO,EAAE,aAAa,EACtB,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,EACZ,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAChC,OAAO,CAAC,IAAI,CAAC,CAgBf;AAED,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,SAAS,EAAE,GAAG,WAAW,CA0DtE"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { type HandlerCallback, type IAgentRuntime, type Media, type Memory } from '@elizaos/core';
|
|
2
|
+
import { type State } from '@elizaos/core';
|
|
3
|
+
export declare function processResourceResult(result: {
|
|
4
|
+
contents: Array<{
|
|
5
|
+
uri: string;
|
|
6
|
+
mimeType?: string;
|
|
7
|
+
text?: string;
|
|
8
|
+
blob?: string;
|
|
9
|
+
}>;
|
|
10
|
+
}, uri: string): {
|
|
11
|
+
resourceContent: string;
|
|
12
|
+
resourceMeta: string;
|
|
13
|
+
};
|
|
14
|
+
export declare function processToolResult(result: {
|
|
15
|
+
content: Array<{
|
|
16
|
+
type: string;
|
|
17
|
+
text?: string;
|
|
18
|
+
mimeType?: string;
|
|
19
|
+
data?: string;
|
|
20
|
+
resource?: {
|
|
21
|
+
uri: string;
|
|
22
|
+
text?: string;
|
|
23
|
+
blob?: string;
|
|
24
|
+
};
|
|
25
|
+
}>;
|
|
26
|
+
isError?: boolean;
|
|
27
|
+
}, serverName: string, toolName: string, runtime: IAgentRuntime, messageEntityId: string): {
|
|
28
|
+
toolOutput: string;
|
|
29
|
+
hasAttachments: boolean;
|
|
30
|
+
attachments: Media[];
|
|
31
|
+
};
|
|
32
|
+
export declare function handleResourceAnalysis(runtime: IAgentRuntime, message: Memory, uri: string, serverName: string, resourceContent: string, resourceMeta: string, callback?: HandlerCallback): Promise<void>;
|
|
33
|
+
export declare function handleToolResponse(runtime: IAgentRuntime, message: Memory, serverName: string, toolName: string, toolArgs: Record<string, unknown>, toolOutput: string, hasAttachments: boolean, attachments: Media[], state: State, mcpProvider: {
|
|
34
|
+
values: {
|
|
35
|
+
mcp: unknown;
|
|
36
|
+
};
|
|
37
|
+
data: {
|
|
38
|
+
mcp: unknown;
|
|
39
|
+
};
|
|
40
|
+
text: string;
|
|
41
|
+
}, callback?: HandlerCallback): Promise<void>;
|
|
42
|
+
export declare function sendInitialResponse(callback?: HandlerCallback): Promise<void>;
|
|
43
|
+
//# sourceMappingURL=processing.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"processing.d.ts","sourceRoot":"","sources":["../../src/utils/processing.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,KAAK,KAAK,EACV,KAAK,MAAM,EAIZ,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,KAAK,KAAK,EAA0B,MAAM,eAAe,CAAC;AAgBnE,wBAAgB,qBAAqB,CACnC,MAAM,EAAE;IACN,QAAQ,EAAE,KAAK,CAAC;QACd,GAAG,EAAE,MAAM,CAAC;QACZ,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,IAAI,CAAC,EAAE,MAAM,CAAC;KACf,CAAC,CAAC;CACJ,EACD,GAAG,EAAE,MAAM,GACV;IAAE,eAAe,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,MAAM,CAAA;CAAE,CAkBnD;AAED,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE;IACN,OAAO,EAAE,KAAK,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,QAAQ,CAAC,EAAE;YACT,GAAG,EAAE,MAAM,CAAC;YACZ,IAAI,CAAC,EAAE,MAAM,CAAC;YACd,IAAI,CAAC,EAAE,MAAM,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4
|
+
properties: {
|
|
5
|
+
serverName: {
|
|
6
|
+
type: string;
|
|
7
|
+
minLength: number;
|
|
8
|
+
errorMessage: string;
|
|
9
|
+
};
|
|
10
|
+
toolName: {
|
|
11
|
+
type: string;
|
|
12
|
+
minLength: number;
|
|
13
|
+
errorMessage: string;
|
|
14
|
+
};
|
|
15
|
+
reasoning: {
|
|
16
|
+
type: string;
|
|
17
|
+
};
|
|
18
|
+
noToolAvailable: {
|
|
19
|
+
type: string;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
export interface ToolSelectionName {
|
|
24
|
+
serverName: string;
|
|
25
|
+
toolName: string;
|
|
26
|
+
reasoning?: string;
|
|
27
|
+
noToolAvailable?: boolean;
|
|
28
|
+
}
|
|
29
|
+
export declare const toolSelectionArgumentSchema: {
|
|
30
|
+
type: string;
|
|
31
|
+
required: string[];
|
|
32
|
+
properties: {
|
|
33
|
+
toolArguments: {
|
|
34
|
+
type: string;
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
export interface ToolSelectionArgument {
|
|
39
|
+
toolArguments: Record<string, unknown>;
|
|
40
|
+
}
|
|
41
|
+
export declare const ResourceSelectionSchema: {
|
|
42
|
+
type: string;
|
|
43
|
+
required: string[];
|
|
44
|
+
properties: {
|
|
45
|
+
serverName: {
|
|
46
|
+
type: string;
|
|
47
|
+
minLength: number;
|
|
48
|
+
errorMessage: string;
|
|
49
|
+
};
|
|
50
|
+
uri: {
|
|
51
|
+
type: string;
|
|
52
|
+
minLength: number;
|
|
53
|
+
errorMessage: string;
|
|
54
|
+
};
|
|
55
|
+
reasoning: {
|
|
56
|
+
type: string;
|
|
57
|
+
};
|
|
58
|
+
noResourceAvailable: {
|
|
59
|
+
type: string;
|
|
60
|
+
};
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
export interface ResourceSelection {
|
|
64
|
+
serverName: string;
|
|
65
|
+
uri: string;
|
|
66
|
+
reasoning?: string;
|
|
67
|
+
noResourceAvailable?: boolean;
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=schemas.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../src/utils/schemas.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;CAqBnC,CAAC;AAEF,MAAM,WAAW,iBAAiB;IAChC,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B;AAED,eAAO,MAAM,2BAA2B;;;;;;;;CAQvC,CAAC;AAEF,MAAM,WAAW,qBAAqB;IACpC,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACxC;AAED,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;CAqBnC,CAAC;AAEF,MAAM,WAAW,iBAAiB;IAChC,UAAU,EAAE,MAAM,CAAC;IACnB,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC/B"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { type HandlerCallback, type IAgentRuntime, type Memory, type State } from "@elizaos/core";
|
|
2
|
+
import type { McpProvider } from "../types";
|
|
3
|
+
import type { ToolSelectionName, ToolSelectionArgument } from "./schemas";
|
|
4
|
+
export interface CreateToolSelectionOptions {
|
|
5
|
+
runtime: IAgentRuntime;
|
|
6
|
+
state: State;
|
|
7
|
+
message: Memory;
|
|
8
|
+
callback?: HandlerCallback;
|
|
9
|
+
mcpProvider: McpProvider;
|
|
10
|
+
toolSelectionName?: ToolSelectionName;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Creates a tool selection name based on the current state and MCP provider.
|
|
14
|
+
* @returns A tool selection name object or null if the selection is invalid.
|
|
15
|
+
* ```json
|
|
16
|
+
* {
|
|
17
|
+
* "serverName": "github",
|
|
18
|
+
* "toolName": "get_file_contents",
|
|
19
|
+
* "reasoning": "The user wants to see the README from the facebook/react repository based on our conversation."
|
|
20
|
+
* "noToolSelection": false
|
|
21
|
+
* }
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
export declare function createToolSelectionName({ runtime, state, message, callback, mcpProvider, }: CreateToolSelectionOptions): Promise<ToolSelectionName | null>;
|
|
25
|
+
/**
|
|
26
|
+
* Creates a tool selection argument based on the current state and MCP provider.
|
|
27
|
+
* @returns A tool selection argument object or null if the selection is invalid.
|
|
28
|
+
* ```json
|
|
29
|
+
* {
|
|
30
|
+
* "toolArguments": {
|
|
31
|
+
* "file_path": "facebook/react/README.md",
|
|
32
|
+
* "repo": "facebook/react"
|
|
33
|
+
* },
|
|
34
|
+
* "reasoning": "The user wants to see the README from the facebook/react repository based on our conversation."
|
|
35
|
+
* }
|
|
36
|
+
*/
|
|
37
|
+
export declare function createToolSelectionArgument({ runtime, state, message, callback, mcpProvider, toolSelectionName, }: CreateToolSelectionOptions): Promise<ToolSelectionArgument | null>;
|
|
38
|
+
//# sourceMappingURL=selection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"selection.d.ts","sourceRoot":"","sources":["../../src/utils/selection.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,KAAK,MAAM,EAEX,KAAK,KAAK,EAGX,MAAM,eAAe,CAAC;AAEvB,OAAO,KAAK,EAAE,WAAW,EAAmB,MAAM,UAAU,CAAC;AAC7D,OAAO,KAAK,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;AAO1E,MAAM,WAAW,0BAA0B;IACzC,OAAO,EAAE,aAAa,CAAC;IACvB,KAAK,EAAE,KAAK,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,eAAe,CAAC;IAC3B,WAAW,EAAE,WAAW,CAAC;IACzB,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;CACvC;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,uBAAuB,CAAC,EAC5C,OAAO,EACP,KAAK,EACL,OAAO,EACP,QAAQ,EACR,WAAW,GACZ,EAAE,0BAA0B,GAAG,OAAO,CAAC,iBAAiB,GAAG,IAAI,CAAC,CAwBhE;AACD;;;;;;;;;;;GAWG;AACH,wBAAsB,2BAA2B,CAAC,EAChD,OAAO,EACP,KAAK,EACL,OAAO,EACP,QAAQ,EACR,WAAW,EACX,iBAAiB,GAClB,EAAE,0BAA0B,GAAG,OAAO,CAAC,qBAAqB,GAAG,IAAI,CAAC,CA0CpE"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { State } from "@elizaos/core";
|
|
2
|
+
import { type ValidationResult } from "../types";
|
|
3
|
+
import { type ToolSelectionArgument, type ToolSelectionName } from "./schemas";
|
|
4
|
+
export interface ToolSelection {
|
|
5
|
+
serverName: string;
|
|
6
|
+
toolName: string;
|
|
7
|
+
arguments: Record<string, unknown>;
|
|
8
|
+
reasoning?: string;
|
|
9
|
+
noToolAvailable?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export interface ResourceSelection {
|
|
12
|
+
serverName: string;
|
|
13
|
+
uri: string;
|
|
14
|
+
reasoning?: string;
|
|
15
|
+
noResourceAvailable?: boolean;
|
|
16
|
+
}
|
|
17
|
+
export declare function validateToolSelectionName(parsed: unknown, state: State): ValidationResult<ToolSelectionName>;
|
|
18
|
+
/**
|
|
19
|
+
* Validates the tool selection argument object.
|
|
20
|
+
* @param parsed - The tool selection object to validate
|
|
21
|
+
* @param toolInputSchema - The input schema for the tool
|
|
22
|
+
* @returns An object indicating success or failure of validation
|
|
23
|
+
*/
|
|
24
|
+
export declare function validateToolSelectionArgument(parsed: unknown, toolInputSchema: Record<string, unknown>): ValidationResult<ToolSelectionArgument>;
|
|
25
|
+
export declare function validateResourceSelection(selection: unknown): {
|
|
26
|
+
success: true;
|
|
27
|
+
data: ResourceSelection;
|
|
28
|
+
} | {
|
|
29
|
+
success: false;
|
|
30
|
+
error: string;
|
|
31
|
+
};
|
|
32
|
+
export declare function createToolSelectionFeedbackPrompt(originalResponse: string, errorMessage: string, composedState: State, userMessage: string): string;
|
|
33
|
+
export declare function createResourceSelectionFeedbackPrompt(originalResponse: string, errorMessage: string, composedState: State, userMessage: string): string;
|
|
34
|
+
//# sourceMappingURL=validation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../../src/utils/validation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAIL,KAAK,gBAAgB,EACtB,MAAM,UAAU,CAAC;AAElB,OAAO,EAGL,KAAK,qBAAqB,EAC1B,KAAK,iBAAiB,EACvB,MAAM,WAAW,CAAC;AAEnB,MAAM,WAAW,aAAa;IAC5B,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACnC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B;AAED,MAAM,WAAW,iBAAiB;IAChC,UAAU,EAAE,MAAM,CAAC;IACnB,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC/B;AAED,wBAAgB,yBAAyB,CACvC,MAAM,EAAE,OAAO,EACf,KAAK,EAAE,KAAK,GACX,gBAAgB,CAAC,iBAAiB,CAAC,CA2BrC;AAED;;;;;GAKG;AACH,wBAAgB,6BAA6B,CAC3C,MAAM,EAAE,OAAO,EACf,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GACvC,gBAAgB,CAAC,qBAAqB,CAAC,CAoBzC;AAED,wBAAgB,yBAAyB,CACvC,SAAS,EAAE,OAAO,GACjB;IAAE,OAAO,EAAE,IAAI,CAAC;IAAC,IAAI,EAAE,iBAAiB,CAAA;CAAE,GAAG;IAAE,OAAO,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAEhF;AAED,wBAAgB,iCAAiC,CAC/C,gBAAgB,EAAE,MAAM,EACxB,YAAY,EAAE,MAAM,EACpB,aAAa,EAAE,KAAK,EACpB,WAAW,EAAE,MAAM,GAClB,MAAM,CAyBR;AAED,wBAAgB,qCAAqC,CACnD,gBAAgB,EAAE,MAAM,EACxB,YAAY,EAAE,MAAM,EACpB,aAAa,EAAE,KAAK,EACpB,WAAW,EAAE,MAAM,GAClB,MAAM,CA4BR"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { type HandlerCallback, type Memory, type IAgentRuntime, type State } from '@elizaos/core';
|
|
2
|
+
import { type ValidationResult } from '../types';
|
|
3
|
+
export type Input = string | object;
|
|
4
|
+
type CreateFeedbackPromptFnOptions = (originalResponse: Input, errorMessage: string, composedState: State, userMessage: string) => string;
|
|
5
|
+
export interface WithModelRetryOptions<T> {
|
|
6
|
+
runtime: IAgentRuntime;
|
|
7
|
+
message: Memory;
|
|
8
|
+
state: State;
|
|
9
|
+
input: Input;
|
|
10
|
+
validationFn: (data: Input) => ValidationResult<T>;
|
|
11
|
+
createFeedbackPromptFn: CreateFeedbackPromptFnOptions;
|
|
12
|
+
callback?: HandlerCallback;
|
|
13
|
+
failureMsg?: string;
|
|
14
|
+
retryCount?: number;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Retries the model selection process in case of parsing errors.
|
|
18
|
+
* @param input - The initial input to be parsed
|
|
19
|
+
* @param validationFn - The function to validate the parsed data
|
|
20
|
+
* @param createFeedbackPromptFn - The function to create a feedback prompt
|
|
21
|
+
* @param failureMsg - The message to be sent in case of failure
|
|
22
|
+
* @param retryCount - The current retry count
|
|
23
|
+
* @returns
|
|
24
|
+
*/
|
|
25
|
+
export declare function withModelRetry<T>({ runtime, message, state, callback, input, validationFn, createFeedbackPromptFn, failureMsg, retryCount, }: WithModelRetryOptions<T>): Promise<T | null>;
|
|
26
|
+
export {};
|
|
27
|
+
//# sourceMappingURL=wrapper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wrapper.d.ts","sourceRoot":"","sources":["../../src/utils/wrapper.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,eAAe,EACpB,KAAK,MAAM,EACX,KAAK,aAAa,EAClB,KAAK,KAAK,EAGX,MAAM,eAAe,CAAC;AACvB,OAAO,EAAuB,KAAK,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAEtE,MAAM,MAAM,KAAK,GAAG,MAAM,GAAG,MAAM,CAAC;AAEpC,KAAK,6BAA6B,GAAG,CACnC,gBAAgB,EAAE,KAAK,EACvB,YAAY,EAAE,MAAM,EACpB,aAAa,EAAE,KAAK,EACpB,WAAW,EAAE,MAAM,KAChB,MAAM,CAAC;AAEZ,MAAM,WAAW,qBAAqB,CAAC,CAAC;IACtC,OAAO,EAAE,aAAa,CAAC;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,KAAK,CAAC;IACb,KAAK,EAAE,KAAK,CAAC;IACb,YAAY,EAAE,CAAC,IAAI,EAAE,KAAK,KAAK,gBAAgB,CAAC,CAAC,CAAC,CAAC;IACnD,sBAAsB,EAAE,6BAA6B,CAAC;IACtD,QAAQ,CAAC,EAAE,eAAe,CAAC;IAC3B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;;;;;;GAQG;AACH,wBAAsB,cAAc,CAAC,CAAC,EAAE,EACtC,OAAO,EACP,OAAO,EACP,KAAK,EACL,QAAQ,EACR,KAAK,EACL,YAAY,EACZ,sBAAsB,EACtB,UAAU,EACV,UAAc,GACf,EAAE,qBAAqB,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC,CA6D9C"}
|
package/package.json
CHANGED
|
@@ -1,11 +1,30 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elizaos/plugin-mcp",
|
|
3
3
|
"description": "ElizaOS plugin to integrate with MCP (Model Context Protocol) servers",
|
|
4
|
-
"
|
|
4
|
+
"version": "1.3.0",
|
|
5
|
+
"type": "module",
|
|
5
6
|
"main": "dist/index.js",
|
|
7
|
+
"module": "dist/index.js",
|
|
6
8
|
"types": "dist/index.d.ts",
|
|
7
|
-
"
|
|
8
|
-
"
|
|
9
|
+
"sideEffects": false,
|
|
10
|
+
"exports": {
|
|
11
|
+
"./package.json": "./package.json",
|
|
12
|
+
".": {
|
|
13
|
+
"types": "./dist/index.d.ts",
|
|
14
|
+
"node": {
|
|
15
|
+
"types": "./dist/index.d.ts",
|
|
16
|
+
"import": "./dist/index.js",
|
|
17
|
+
"require": "./dist/cjs/index.cjs",
|
|
18
|
+
"default": "./dist/index.js"
|
|
19
|
+
},
|
|
20
|
+
"import": "./dist/index.js",
|
|
21
|
+
"require": "./dist/cjs/index.cjs",
|
|
22
|
+
"default": "./dist/index.js"
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
"files": [
|
|
26
|
+
"dist"
|
|
27
|
+
],
|
|
9
28
|
"license": "MIT",
|
|
10
29
|
"repository": {
|
|
11
30
|
"type": "git",
|
|
@@ -22,11 +41,14 @@
|
|
|
22
41
|
"elizaos-plugins"
|
|
23
42
|
],
|
|
24
43
|
"scripts": {
|
|
25
|
-
"build": "bun build
|
|
26
|
-
"
|
|
44
|
+
"build": "bun run build.ts",
|
|
45
|
+
"dev": "bun --hot build.ts",
|
|
46
|
+
"clean": "rm -rf dist .turbo node_modules .turbo-tsconfig.json tsconfig.tsbuildinfo",
|
|
27
47
|
"check:write": "bunx @biomejs/biome check --write ./src",
|
|
28
48
|
"check": "bunx @biomejs/biome check ./src",
|
|
29
49
|
"ci": "bunx @biomejs/biome ci ./src",
|
|
50
|
+
"format": "bunx @biomejs/biome format --write ./src",
|
|
51
|
+
"format:check": "bunx @biomejs/biome format ./src",
|
|
30
52
|
"version:patch": "bunx bumpp patch --tag -y",
|
|
31
53
|
"version:minor": "bunx bumpp minor --tag -y",
|
|
32
54
|
"version:major": "bunx bumpp major --tag -y",
|
|
@@ -38,11 +60,12 @@
|
|
|
38
60
|
"@biomejs/biome": "1.9.4",
|
|
39
61
|
"@types/bun": "1.2.5",
|
|
40
62
|
"@types/json-schema": "^7.0.15",
|
|
63
|
+
"@types/node": "^22.10.0",
|
|
41
64
|
"bumpp": "10.1.0",
|
|
42
|
-
"typescript": "^5.
|
|
65
|
+
"typescript": "^5.7.2"
|
|
43
66
|
},
|
|
44
67
|
"dependencies": {
|
|
45
|
-
"@elizaos/core": "^1.
|
|
68
|
+
"@elizaos/core": "^1.5.4",
|
|
46
69
|
"@modelcontextprotocol/sdk": "^1.7.0",
|
|
47
70
|
"ajv": "^8.17.1",
|
|
48
71
|
"json5": "^2.2.3"
|