@arvo-tools/agentic 0.4.1 → 1.0.1
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/dist/Agent/AgentDefaults.d.ts +4 -2
- package/dist/Agent/AgentDefaults.d.ts.map +1 -1
- package/dist/Agent/AgentDefaults.js +3 -0
- package/dist/Agent/AgentDefaults.js.map +1 -1
- package/dist/Agent/agentLoop.d.ts +22 -1
- package/dist/Agent/agentLoop.d.ts.map +1 -1
- package/dist/Agent/agentLoop.js +41 -6
- package/dist/Agent/agentLoop.js.map +1 -1
- package/dist/Agent/index.d.ts +76 -3
- package/dist/Agent/index.d.ts.map +1 -1
- package/dist/Agent/index.js +102 -25
- package/dist/Agent/index.js.map +1 -1
- package/dist/Agent/schema.d.ts +9 -0
- package/dist/Agent/schema.d.ts.map +1 -1
- package/dist/Agent/schema.js +7 -0
- package/dist/Agent/schema.js.map +1 -1
- package/dist/Agent/types.d.ts +222 -58
- package/dist/Agent/types.d.ts.map +1 -1
- package/dist/Agent/utils.d.ts +46 -1
- package/dist/Agent/utils.d.ts.map +1 -1
- package/dist/Agent/utils.js +43 -0
- package/dist/Agent/utils.js.map +1 -1
- package/dist/AgentTool/index.d.ts +30 -0
- package/dist/AgentTool/index.d.ts.map +1 -0
- package/dist/{Agent/agentTool.js → AgentTool/index.js} +27 -1
- package/dist/AgentTool/index.js.map +1 -0
- package/dist/AgentTool/types.d.ts +59 -0
- package/dist/AgentTool/types.d.ts.map +1 -0
- package/dist/AgentTool/types.js +3 -0
- package/dist/AgentTool/types.js.map +1 -0
- package/dist/Integrations/MCPClient.d.ts +62 -29
- package/dist/Integrations/MCPClient.d.ts.map +1 -1
- package/dist/Integrations/MCPClient.js +60 -29
- package/dist/Integrations/MCPClient.js.map +1 -1
- package/dist/Integrations/openai/index.d.ts +25 -0
- package/dist/Integrations/openai/index.d.ts.map +1 -0
- package/dist/Integrations/{openai.js → openai/index.js} +64 -28
- package/dist/Integrations/openai/index.js.map +1 -0
- package/dist/Integrations/prompts.d.ts +8 -0
- package/dist/Integrations/prompts.d.ts.map +1 -0
- package/dist/Integrations/prompts.js +12 -0
- package/dist/Integrations/prompts.js.map +1 -0
- package/dist/Integrations/types.d.ts +101 -0
- package/dist/Integrations/types.d.ts.map +1 -0
- package/dist/Integrations/types.js +3 -0
- package/dist/Integrations/types.js.map +1 -0
- package/dist/index.d.ts +7 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -3
- package/dist/index.js.map +1 -1
- package/dist/interfaces.mcp.d.ts +29 -0
- package/dist/interfaces.mcp.d.ts.map +1 -1
- package/dist/types.d.ts +13 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/Agent/agentTool.d.ts +0 -4
- package/dist/Agent/agentTool.d.ts.map +0 -1
- package/dist/Agent/agentTool.js.map +0 -1
- package/dist/Integrations/openai.d.ts +0 -10
- package/dist/Integrations/openai.d.ts.map +0 -1
- package/dist/Integrations/openai.js.map +0 -1
package/dist/Agent/utils.js
CHANGED
|
@@ -88,6 +88,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
88
88
|
exports.prioritizeToolCalls = exports.tryParseJson = exports.setOpenInferenceResponseOutputAttr = exports.setOpenInferenceUsageOutputAttr = exports.setOpenInferenceToolCallOutputAttr = exports.setOpenInferenceInputAttr = exports.clampStr = exports.generateAgentInternalToolDefinitions = exports.generateMcpToolDefinitions = exports.generateServiceToolDefinitions = void 0;
|
|
89
89
|
var openinference_semantic_conventions_1 = require("@arizeai/openinference-semantic-conventions");
|
|
90
90
|
var zod_to_json_schema_1 = require("zod-to-json-schema");
|
|
91
|
+
/**
|
|
92
|
+
* Transforms a map of Arvo Service Contracts into LLM-compatible Tool Definitions.
|
|
93
|
+
*
|
|
94
|
+
* This function extracts the `accepts` schema from the contract, strips out internal
|
|
95
|
+
* Arvo fields (like `parentSubject$$`), and formats it for the LLM's context window.
|
|
96
|
+
*/
|
|
91
97
|
var generateServiceToolDefinitions = function (services) {
|
|
92
98
|
var e_1, _a;
|
|
93
99
|
var _b, _c, _d;
|
|
@@ -124,6 +130,11 @@ var generateServiceToolDefinitions = function (services) {
|
|
|
124
130
|
return serviceTools;
|
|
125
131
|
};
|
|
126
132
|
exports.generateServiceToolDefinitions = generateServiceToolDefinitions;
|
|
133
|
+
/**
|
|
134
|
+
* Fetches available tools from a connected MCP Client and adapts them to the Agent's internal format.
|
|
135
|
+
*
|
|
136
|
+
* This runs at runtime during the Agent execution loop to ensure the tool list is current.
|
|
137
|
+
*/
|
|
127
138
|
var generateMcpToolDefinitions = function (mcp, config) { return __awaiter(void 0, void 0, void 0, function () {
|
|
128
139
|
var mcpToolList, mcpToolPriorityMap;
|
|
129
140
|
var _a, _b;
|
|
@@ -156,6 +167,10 @@ var generateMcpToolDefinitions = function (mcp, config) { return __awaiter(void
|
|
|
156
167
|
});
|
|
157
168
|
}); };
|
|
158
169
|
exports.generateMcpToolDefinitions = generateMcpToolDefinitions;
|
|
170
|
+
/**
|
|
171
|
+
* Converts local `AgentInternalTool` definitions (Zod schemas) into JSON Schema for the LLM.
|
|
172
|
+
* Uses `zod-to-json-schema` for the conversion.
|
|
173
|
+
*/
|
|
159
174
|
var generateAgentInternalToolDefinitions = function (tools) {
|
|
160
175
|
var e_2, _a;
|
|
161
176
|
var _b;
|
|
@@ -186,10 +201,20 @@ var generateAgentInternalToolDefinitions = function (tools) {
|
|
|
186
201
|
return toolDef;
|
|
187
202
|
};
|
|
188
203
|
exports.generateAgentInternalToolDefinitions = generateAgentInternalToolDefinitions;
|
|
204
|
+
/** Helper utility to truncate long strings (e.g. Base64 images) in logs/traces. */
|
|
189
205
|
var clampStr = function (s, len) {
|
|
190
206
|
return s.length > len ? "".concat(s.slice(0, len), "...") : s;
|
|
191
207
|
};
|
|
192
208
|
exports.clampStr = clampStr;
|
|
209
|
+
/**
|
|
210
|
+
* Populates the OpenTelemetry Span with all LLM Input data using OpenInference Semantic Conventions.
|
|
211
|
+
*
|
|
212
|
+
* This records:
|
|
213
|
+
* 1. The LLM Config (Provider, Model, System Prompt).
|
|
214
|
+
* 2. The full Conversation History (mapped from Arvo format to OpenInference format).
|
|
215
|
+
* 3. Tool Definitions (so traces show what tools were available).
|
|
216
|
+
* 4. Multi-modal content (Image/File placeholders).
|
|
217
|
+
*/
|
|
193
218
|
var setOpenInferenceInputAttr = function (param, span) {
|
|
194
219
|
var _a, e_3, _b, _c, e_4, _d, _e, _f, _g, _h;
|
|
195
220
|
span.setAttributes((_a = {},
|
|
@@ -264,6 +289,10 @@ var setOpenInferenceInputAttr = function (param, span) {
|
|
|
264
289
|
}
|
|
265
290
|
};
|
|
266
291
|
exports.setOpenInferenceInputAttr = setOpenInferenceInputAttr;
|
|
292
|
+
/**
|
|
293
|
+
* Records the LLM's generated Tool Calls to the OpenTelemetry Span.
|
|
294
|
+
* Adds attributes for Function Name and JSON Arguments.
|
|
295
|
+
*/
|
|
267
296
|
var setOpenInferenceToolCallOutputAttr = function (param, span) {
|
|
268
297
|
var _a;
|
|
269
298
|
var _b;
|
|
@@ -287,6 +316,9 @@ var setOpenInferenceToolCallOutputAttr = function (param, span) {
|
|
|
287
316
|
}
|
|
288
317
|
};
|
|
289
318
|
exports.setOpenInferenceToolCallOutputAttr = setOpenInferenceToolCallOutputAttr;
|
|
319
|
+
/**
|
|
320
|
+
* Records Token Usage metrics (Prompt, Completion, Total) to the OpenTelemetry Span.
|
|
321
|
+
*/
|
|
290
322
|
var setOpenInferenceUsageOutputAttr = function (param, span) {
|
|
291
323
|
var _a;
|
|
292
324
|
if (param) {
|
|
@@ -298,6 +330,9 @@ var setOpenInferenceUsageOutputAttr = function (param, span) {
|
|
|
298
330
|
}
|
|
299
331
|
};
|
|
300
332
|
exports.setOpenInferenceUsageOutputAttr = setOpenInferenceUsageOutputAttr;
|
|
333
|
+
/**
|
|
334
|
+
* Records the LLM's final textual response to the OpenTelemetry Span.
|
|
335
|
+
*/
|
|
301
336
|
var setOpenInferenceResponseOutputAttr = function (param, span) {
|
|
302
337
|
var _a, _b;
|
|
303
338
|
span.setAttributes((_a = {},
|
|
@@ -308,6 +343,7 @@ var setOpenInferenceResponseOutputAttr = function (param, span) {
|
|
|
308
343
|
_b));
|
|
309
344
|
};
|
|
310
345
|
exports.setOpenInferenceResponseOutputAttr = setOpenInferenceResponseOutputAttr;
|
|
346
|
+
/** Safe wrapper around JSON.parse that returns null instead of throwing. */
|
|
311
347
|
var tryParseJson = function (str) {
|
|
312
348
|
try {
|
|
313
349
|
return JSON.parse(str);
|
|
@@ -317,6 +353,13 @@ var tryParseJson = function (str) {
|
|
|
317
353
|
}
|
|
318
354
|
};
|
|
319
355
|
exports.tryParseJson = tryParseJson;
|
|
356
|
+
/**
|
|
357
|
+
* Implements the Priority-Based Execution logic.
|
|
358
|
+
*
|
|
359
|
+
* Takes a list of requested tool calls, groups them by their configured priority,
|
|
360
|
+
* and returns **only** the batch with the highest priority. All lower priority
|
|
361
|
+
* calls are discarded.
|
|
362
|
+
*/
|
|
320
363
|
var prioritizeToolCalls = function (toolCalls, nameToToolMap) {
|
|
321
364
|
var e_5, _a;
|
|
322
365
|
var _b, _c, _d, _e, _f;
|
package/dist/Agent/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/Agent/utils.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kGAAsH;AAGtH,yDAAqD;
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/Agent/utils.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kGAAsH;AAGtH,yDAAqD;AAarD;;;;;GAKG;AACI,IAAM,8BAA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C,GAAG,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;QAClC,CAAC;;;;;;;;;IACD,IAAM,UAAU,GAAG,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,UAAC,CAAC,EAAE,CAAC,IAAK,OAAA,CAAC,GAAG,CAAC,EAAL,CAAK,CAAC,CAAC;IACpE,IAAM,eAAe,GAAG,MAAA,UAAU,CAAC,CAAC,CAAC,mCAAI,CAAC,CAAC;IAC3C,OAAO,MAAA,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC,mCAAI,EAAE,CAAC;AAC5C,CAAC,CAAC;AAdW,QAAA,mBAAmB,uBAc9B"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type z from 'zod/v3/external.cjs';
|
|
2
|
+
import type { AgentInternalTool } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Factory function to create an Instrumented Agent Tool.
|
|
5
|
+
*
|
|
6
|
+
* Wraps your raw tool logic with **OpenTelemetry Auto-Instrumentation** and **Input Validation**.
|
|
7
|
+
*
|
|
8
|
+
* **Why use this instead of a raw object?**
|
|
9
|
+
* 1. **Observability:** Automatically creates a child Span (`OpenInferenceSpanKind.TOOL`).
|
|
10
|
+
* It records input arguments, output values, and execution duration to your tracing backend.
|
|
11
|
+
* 2. **Safety:** Automatically validates `input` against the Zod schema *before* your function runs.
|
|
12
|
+
* Throws a clear error if the LLM hallucinated invalid arguments.
|
|
13
|
+
* 3. **Type Safety:** Infers generic types for `input` and `output` automatically.
|
|
14
|
+
*
|
|
15
|
+
* @param param - The tool definition.
|
|
16
|
+
* @returns The wrapped, production-ready tool.
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```ts
|
|
20
|
+
* const timeTool = createAgentTool({
|
|
21
|
+
* name: 'get_time',
|
|
22
|
+
* description: 'Returns current server time',
|
|
23
|
+
* input: z.object({}),
|
|
24
|
+
* output: z.object({ time: z.string() }),
|
|
25
|
+
* fn: () => ({ time: new Date().toISOString() })
|
|
26
|
+
* });
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
export declare const createAgentTool: <TInputSchema extends z.ZodTypeAny, TOutputSchema extends z.ZodTypeAny>(param: AgentInternalTool<TInputSchema, TOutputSchema>) => AgentInternalTool<TInputSchema, TOutputSchema>;
|
|
30
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/AgentTool/index.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,CAAC,MAAM,qBAAqB,CAAC;AAEzC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAEjD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,eAAO,MAAM,eAAe,GAC1B,YAAY,SAAS,CAAC,CAAC,UAAU,EACjC,aAAa,SAAS,CAAC,CAAC,UAAU,EAElC,OAAO,iBAAiB,CAAC,YAAY,EAAE,aAAa,CAAC,KAiD/C,iBAAiB,CAAC,YAAY,EAAE,aAAa,CAAC,CAAC"}
|
|
@@ -51,6 +51,32 @@ exports.createAgentTool = void 0;
|
|
|
51
51
|
var openinference_semantic_conventions_1 = require("@arizeai/openinference-semantic-conventions");
|
|
52
52
|
var api_1 = require("@opentelemetry/api");
|
|
53
53
|
var arvo_core_1 = require("arvo-core");
|
|
54
|
+
/**
|
|
55
|
+
* Factory function to create an Instrumented Agent Tool.
|
|
56
|
+
*
|
|
57
|
+
* Wraps your raw tool logic with **OpenTelemetry Auto-Instrumentation** and **Input Validation**.
|
|
58
|
+
*
|
|
59
|
+
* **Why use this instead of a raw object?**
|
|
60
|
+
* 1. **Observability:** Automatically creates a child Span (`OpenInferenceSpanKind.TOOL`).
|
|
61
|
+
* It records input arguments, output values, and execution duration to your tracing backend.
|
|
62
|
+
* 2. **Safety:** Automatically validates `input` against the Zod schema *before* your function runs.
|
|
63
|
+
* Throws a clear error if the LLM hallucinated invalid arguments.
|
|
64
|
+
* 3. **Type Safety:** Infers generic types for `input` and `output` automatically.
|
|
65
|
+
*
|
|
66
|
+
* @param param - The tool definition.
|
|
67
|
+
* @returns The wrapped, production-ready tool.
|
|
68
|
+
*
|
|
69
|
+
* @example
|
|
70
|
+
* ```ts
|
|
71
|
+
* const timeTool = createAgentTool({
|
|
72
|
+
* name: 'get_time',
|
|
73
|
+
* description: 'Returns current server time',
|
|
74
|
+
* input: z.object({}),
|
|
75
|
+
* output: z.object({ time: z.string() }),
|
|
76
|
+
* fn: () => ({ time: new Date().toISOString() })
|
|
77
|
+
* });
|
|
78
|
+
* ```
|
|
79
|
+
*/
|
|
54
80
|
var createAgentTool = function (param) {
|
|
55
81
|
return (__assign(__assign({}, param), { fn: function (input, config) { return __awaiter(void 0, void 0, void 0, function () {
|
|
56
82
|
var _a;
|
|
@@ -108,4 +134,4 @@ var createAgentTool = function (param) {
|
|
|
108
134
|
}); } }));
|
|
109
135
|
};
|
|
110
136
|
exports.createAgentTool = createAgentTool;
|
|
111
|
-
//# sourceMappingURL=
|
|
137
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/AgentTool/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kGAGqD;AACrD,0CAAoD;AACpD,uCAAqE;AAKrE;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACI,IAAM,eAAe,GAAG,UAI7B,KAAqD;IAErD,OAAA,uBACK,KAAK,KACR,EAAE,EAAE,UAAO,KAA4B,EAAE,MAAkC;;;;4BACzE,qBAAM,6BAAiB,CAAC,WAAW,EAAE,CAAC,eAAe,CAAC;4BACpD,IAAI,EAAE,oBAAa,KAAK,CAAC,IAAI,cAAW;4BACxC,qBAAqB,EAAE,IAAI;4BAC3B,OAAO,EAAE;gCACP,W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,IAAI,CAAC,GAAG,EAAE,CAAC;;;;;iCAEd;yBACF,CAAC,EAAA;4BA3CF,sBAAA,SA2CE,EAAA;;;aAAA,IAC8C;AA/CpD,CA+CoD,CAAC;AArD1C,QAAA,eAAe,mBAqD2B"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import type z from 'zod';
|
|
2
|
+
import type { OtelInfoType, PromiseAble } from '../types';
|
|
3
|
+
/**
|
|
4
|
+
* Defines the structure of a **Synchronous Internal Tool**.
|
|
5
|
+
*
|
|
6
|
+
* Internal tools are JavaScript/TypeScript functions that execute *inside* the Agent's loop.
|
|
7
|
+
*
|
|
8
|
+
* @remarks
|
|
9
|
+
* **Architectural Note:**
|
|
10
|
+
* Unlike Arvo Services (which trigger a "Suspend & Emit" lifecycle), Internal Tools are atomic.
|
|
11
|
+
* The Agent calls them, awaits the result, and continues reasoning in the same execution tick.
|
|
12
|
+
*
|
|
13
|
+
* **Best Practices:**
|
|
14
|
+
* - Use for **Fast, CPU-bound** logic (Math, Data Transformation, Regex).
|
|
15
|
+
* - Use for **Read-only** operations that don't require distributed consensus.
|
|
16
|
+
* - Do **not** use for long-running tasks, as this blocks the Agent execution.
|
|
17
|
+
*/
|
|
18
|
+
export type AgentInternalTool<TInputSchema extends z.ZodTypeAny = any, TOutputSchema extends z.ZodTypeAny = any> = {
|
|
19
|
+
/**
|
|
20
|
+
* The unique identifier for this tool (e.g. `calculator`, `get_current_time`).
|
|
21
|
+
* This name is injected into the LLM's system prompt.
|
|
22
|
+
*/
|
|
23
|
+
name: string;
|
|
24
|
+
/**
|
|
25
|
+
* This string is critical. It tells the LLM *when* and *why* to use this tool.
|
|
26
|
+
* @example
|
|
27
|
+
* "Calculate the MD5 hash of a string. Use this whenever the user asks for a checksum."
|
|
28
|
+
*/
|
|
29
|
+
description: string;
|
|
30
|
+
/**
|
|
31
|
+
* Zod Schema defining the arguments the LLM must provide.
|
|
32
|
+
* Arvo automatically validates the LLM's JSON output against this schema before calling `fn`.
|
|
33
|
+
*/
|
|
34
|
+
input: TInputSchema;
|
|
35
|
+
/**
|
|
36
|
+
* Zod Schema defining what this tool returns.
|
|
37
|
+
* Used for type inference and documentation, though runtime validation of the result is optional.
|
|
38
|
+
*/
|
|
39
|
+
output: TOutputSchema;
|
|
40
|
+
/**
|
|
41
|
+
* If the LLM attempts to call multiple tools in parallel (e.g. `delete_user` + `human_approval`),
|
|
42
|
+
* Arvo sorts calls by priority and **only executes the highest priority batch**.
|
|
43
|
+
* Lower priority calls are silently dropped to enforce safety/auth guardrails.
|
|
44
|
+
*
|
|
45
|
+
* @defaultValue 0
|
|
46
|
+
*/
|
|
47
|
+
priority?: number;
|
|
48
|
+
/**
|
|
49
|
+
* The implementation logic.
|
|
50
|
+
*
|
|
51
|
+
* @param input - The validated arguments matching `TInputSchema`. You do not need to re-validate.
|
|
52
|
+
* @param config - Observability context (Span/Headers) to link any internal logging or network calls.
|
|
53
|
+
* @returns The result matching `TOutputSchema`.
|
|
54
|
+
*/
|
|
55
|
+
fn: (input: z.infer<TInputSchema>, config: {
|
|
56
|
+
otelInfo: OtelInfoType;
|
|
57
|
+
}) => PromiseAble<z.infer<TOutputSchema>>;
|
|
58
|
+
};
|
|
59
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/AgentTool/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AACzB,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAE1D;;;;;;;;;;;;;;GAcG;AACH,MAAM,MAAM,iBAAiB,CAE3B,YAAY,SAAS,CAAC,CAAC,UAAU,GAAG,GAAG,EAEvC,aAAa,SAAS,CAAC,CAAC,UAAU,GAAG,GAAG,IACtC;IACF;;;OAGG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;;;OAIG;IACH,WAAW,EAAE,MAAM,CAAC;IAEpB;;;OAGG;IACH,KAAK,EAAE,YAAY,CAAC;IAEpB;;;OAGG;IACH,MAAM,EAAE,aAAa,CAAC;IAEtB;;;;;;OAMG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;;;;;OAMG;IACH,EAAE,EAAE,CACF,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,YAAY,CAAC,EAC5B,MAAM,EAAE;QAAE,QAAQ,EAAE,YAAY,CAAA;KAAE,KAC/B,WAAW,CAAC,CAAC,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC;CAC1C,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/AgentTool/types.ts"],"names":[],"mappings":""}
|
|
@@ -1,12 +1,32 @@
|
|
|
1
1
|
import type { IMCPClient } from '../interfaces.mcp.js';
|
|
2
2
|
import type { OtelInfoType } from '../types.js';
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* A Production-grade Client for the Model Context Protocol (MCP).
|
|
5
5
|
*
|
|
6
|
-
* This
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
6
|
+
* This class bridges Arvo Agents with the external MCP ecosystem, allowing agents to
|
|
7
|
+
* interact with filesystem, databases, GitHub, Slack, and other standardized MCP servers.
|
|
8
|
+
*
|
|
9
|
+
* @remarks
|
|
10
|
+
* **Key Features:**
|
|
11
|
+
* - **Auto-Transport Selection:** Automatically chooses between `SSEClientTransport` and
|
|
12
|
+
* `StreamableHTTPClientTransport` based on the URL pattern (checks for `/mcp` suffix).
|
|
13
|
+
* - **Orchestration Control:** Supports mapping priorities to external tools, allowing
|
|
14
|
+
* MCP tools to participate in Arvo's **Priority Batch Execution** logic.
|
|
15
|
+
* - **Observability:** Deep integration with Arvo's OpenTelemetry system to trace
|
|
16
|
+
* connection status and tool execution metrics.
|
|
17
|
+
* - **Tool Caching:** Discovers and caches tool definitions upon connection to minimize latency
|
|
18
|
+
* during the Agent's reasoning loop.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```ts
|
|
22
|
+
* const mcp = new MCPClient({
|
|
23
|
+
* url: 'http://localhost:8080/sse',
|
|
24
|
+
* // Give the 'delete_file' tool high priority so it executes before other tools
|
|
25
|
+
* toolPriority: {
|
|
26
|
+
* 'delete_file': 100
|
|
27
|
+
* }
|
|
28
|
+
* });
|
|
29
|
+
* ```
|
|
10
30
|
*/
|
|
11
31
|
export declare class MCPClient implements IMCPClient {
|
|
12
32
|
private client;
|
|
@@ -14,35 +34,45 @@ export declare class MCPClient implements IMCPClient {
|
|
|
14
34
|
private availableTools;
|
|
15
35
|
private readonly url;
|
|
16
36
|
private readonly requestInit;
|
|
37
|
+
private readonly toolPriority;
|
|
38
|
+
/**
|
|
39
|
+
* Creates a new MCP Client.
|
|
40
|
+
*
|
|
41
|
+
* @param param - Configuration object or a Lazy Configuration function.
|
|
42
|
+
*
|
|
43
|
+
* **Why use a function?**
|
|
44
|
+
* Using a function is recommended if the URL, Auth Headers, or Tool Priorities
|
|
45
|
+
* need to be resolved at **Runtime** (e.g., fetched from a Secrets Manager or Env Var)
|
|
46
|
+
* rather than at **Instantiation time**.
|
|
47
|
+
*/
|
|
17
48
|
constructor(param: {
|
|
18
49
|
url: string;
|
|
50
|
+
toolPriority?: Record<string, number>;
|
|
19
51
|
requestInit?: RequestInit;
|
|
20
52
|
} | (() => {
|
|
21
53
|
url: string;
|
|
54
|
+
toolPriority?: Record<string, number>;
|
|
22
55
|
requestInit?: RequestInit;
|
|
23
56
|
}));
|
|
24
57
|
/**
|
|
25
|
-
*
|
|
58
|
+
* Initializes the connection to the remote MCP Server.
|
|
26
59
|
*
|
|
27
|
-
* This method
|
|
28
|
-
* 1.
|
|
29
|
-
* 2.
|
|
30
|
-
* 3.
|
|
31
|
-
* 4. Retrieves and caches the list of available tools
|
|
32
|
-
* 5. Logs all operations to the provided OpenTelemetry span
|
|
60
|
+
* This lifecycle method:
|
|
61
|
+
* 1. Resolves the Transport (SSE vs HTTP).
|
|
62
|
+
* 2. Performs the protocol handshake.
|
|
63
|
+
* 3. Fetches the list of available tools immediately (to populate the Agent's context).
|
|
33
64
|
*
|
|
34
|
-
* @
|
|
35
|
-
* @throws
|
|
65
|
+
* @param config - Trace context.
|
|
66
|
+
* @throws Error if the connection fails or handshake is rejected.
|
|
36
67
|
*/
|
|
37
68
|
connect(config: {
|
|
38
69
|
otelInfo: OtelInfoType;
|
|
39
70
|
}): Promise<void>;
|
|
40
71
|
/**
|
|
41
|
-
*
|
|
72
|
+
* Returns the Tool Definitions discovered during the `connect()` phase.
|
|
42
73
|
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
* This method returns an empty array if not connected.
|
|
74
|
+
* This maps the raw MCP Tool format into Arvo's `AgentToolDefinition` structure
|
|
75
|
+
* so they can be injected into the LLM's context window.
|
|
46
76
|
*/
|
|
47
77
|
getTools(config: {
|
|
48
78
|
otelInfo: OtelInfoType;
|
|
@@ -52,12 +82,13 @@ export declare class MCPClient implements IMCPClient {
|
|
|
52
82
|
inputSchema: Record<string, any>;
|
|
53
83
|
}[]>;
|
|
54
84
|
/**
|
|
55
|
-
*
|
|
85
|
+
* Executes a tool on the remote MCP Server.
|
|
56
86
|
*
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
*
|
|
87
|
+
* Wraps the execution in a dedicated OpenTelemetry Child Span (`MCP.invoke<tool_name>`)
|
|
88
|
+
* to track latency and success/failure rates of the external system.
|
|
89
|
+
*
|
|
90
|
+
* @param param - The tool name and argument payload generated by the LLM.
|
|
91
|
+
* @returns The simplified JSON string result to be fed back to the LLM.
|
|
61
92
|
*/
|
|
62
93
|
invokeTool(param: {
|
|
63
94
|
name: string;
|
|
@@ -66,15 +97,17 @@ export declare class MCPClient implements IMCPClient {
|
|
|
66
97
|
otelInfo: OtelInfoType;
|
|
67
98
|
}): Promise<string>;
|
|
68
99
|
/**
|
|
69
|
-
*
|
|
70
|
-
*
|
|
71
|
-
* This method safely closes the connection to the MCP server if one exists,
|
|
72
|
-
* resets the connection state, and clears cached data. It's safe to call
|
|
73
|
-
* multiple times - subsequent calls will be no-ops if already disconnected.
|
|
100
|
+
* Terminates the transport session and resets clients state.
|
|
101
|
+
* Safe to call multiple times (idempotent).
|
|
74
102
|
*/
|
|
75
103
|
disconnect(config: {
|
|
76
104
|
otelInfo: OtelInfoType;
|
|
77
105
|
}): Promise<void>;
|
|
78
|
-
|
|
106
|
+
/**
|
|
107
|
+
* Retrieves the priority configuration for MCP Tools.
|
|
108
|
+
*
|
|
109
|
+
* This allows external MCP tools to explicitly participate in Arvo's **Priority Batch Execution**.
|
|
110
|
+
*/
|
|
111
|
+
getToolPriority(): Promise<Record<string, number>>;
|
|
79
112
|
}
|
|
80
113
|
//# sourceMappingURL=MCPClient.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MCPClient.d.ts","sourceRoot":"","sources":["../../src/Integrations/MCPClient.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEhD
|
|
1
|
+
{"version":3,"file":"MCPClient.d.ts","sourceRoot":"","sources":["../../src/Integrations/MCPClient.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEhD;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,qBAAa,SAAU,YAAW,UAAU;IAC1C,OAAO,CAAC,MAAM,CAAgB;IAC9B,OAAO,CAAC,WAAW,CAAU;IAC7B,OAAO,CAAC,cAAc,CAAS;IAC/B,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAe;IACnC,OAAO,CAAC,QAAQ,CAAC,WA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|
54
54
|
var api_1 = require("@opentelemetry/api");
|
|
55
55
|
var arvo_core_1 = require("arvo-core");
|
|
56
56
|
/**
|
|
57
|
-
*
|
|
57
|
+
* A Production-grade Client for the Model Context Protocol (MCP).
|
|
58
58
|
*
|
|
59
|
-
* This
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
*
|
|
59
|
+
* This class bridges Arvo Agents with the external MCP ecosystem, allowing agents to
|
|
60
|
+
* interact with filesystem, databases, GitHub, Slack, and other standardized MCP servers.
|
|
61
|
+
*
|
|
62
|
+
* @remarks
|
|
63
|
+
* **Key Features:**
|
|
64
|
+
* - **Auto-Transport Selection:** Automatically chooses between `SSEClientTransport` and
|
|
65
|
+
* `StreamableHTTPClientTransport` based on the URL pattern (checks for `/mcp` suffix).
|
|
66
|
+
* - **Orchestration Control:** Supports mapping priorities to external tools, allowing
|
|
67
|
+
* MCP tools to participate in Arvo's **Priority Batch Execution** logic.
|
|
68
|
+
* - **Observability:** Deep integration with Arvo's OpenTelemetry system to trace
|
|
69
|
+
* connection status and tool execution metrics.
|
|
70
|
+
* - **Tool Caching:** Discovers and caches tool definitions upon connection to minimize latency
|
|
71
|
+
* during the Agent's reasoning loop.
|
|
72
|
+
*
|
|
73
|
+
* @example
|
|
74
|
+
* ```ts
|
|
75
|
+
* const mcp = new MCPClient({
|
|
76
|
+
* url: 'http://localhost:8080/sse',
|
|
77
|
+
* // Give the 'delete_file' tool high priority so it executes before other tools
|
|
78
|
+
* toolPriority: {
|
|
79
|
+
* 'delete_file': 100
|
|
80
|
+
* }
|
|
81
|
+
* });
|
|
82
|
+
* ```
|
|
63
83
|
*/
|
|
64
84
|
var MCPClient = /** @class */ (function () {
|
|
85
|
+
/**
|
|
86
|
+
* Creates a new MCP Client.
|
|
87
|
+
*
|
|
88
|
+
* @param param - Configuration object or a Lazy Configuration function.
|
|
89
|
+
*
|
|
90
|
+
* **Why use a function?**
|
|
91
|
+
* Using a function is recommended if the URL, Auth Headers, or Tool Priorities
|
|
92
|
+
* need to be resolved at **Runtime** (e.g., fetched from a Secrets Manager or Env Var)
|
|
93
|
+
* rather than at **Instantiation time**.
|
|
94
|
+
*/
|
|
65
95
|
function MCPClient(param) {
|
|
66
96
|
this.client = null;
|
|
67
97
|
this.isConnected = false;
|
|
68
98
|
this.availableTools = [];
|
|
69
99
|
this.url = function () { return (typeof param === 'function' ? param() : param).url; };
|
|
70
100
|
this.requestInit = function () { var _a; return (_a = (typeof param === 'function' ? param() : param).requestInit) !== null && _a !== void 0 ? _a : {}; };
|
|
101
|
+
this.toolPriority = function () { var _a; return (_a = (typeof param === 'function' ? param() : param).toolPriority) !== null && _a !== void 0 ? _a : {}; };
|
|
71
102
|
}
|
|
72
103
|
/**
|
|
73
|
-
*
|
|
104
|
+
* Initializes the connection to the remote MCP Server.
|
|
74
105
|
*
|
|
75
|
-
* This method
|
|
76
|
-
* 1.
|
|
77
|
-
* 2.
|
|
78
|
-
* 3.
|
|
79
|
-
* 4. Retrieves and caches the list of available tools
|
|
80
|
-
* 5. Logs all operations to the provided OpenTelemetry span
|
|
106
|
+
* This lifecycle method:
|
|
107
|
+
* 1. Resolves the Transport (SSE vs HTTP).
|
|
108
|
+
* 2. Performs the protocol handshake.
|
|
109
|
+
* 3. Fetches the list of available tools immediately (to populate the Agent's context).
|
|
81
110
|
*
|
|
82
|
-
* @
|
|
83
|
-
* @throws
|
|
111
|
+
* @param config - Trace context.
|
|
112
|
+
* @throws Error if the connection fails or handshake is rejected.
|
|
84
113
|
*/
|
|
85
114
|
MCPClient.prototype.connect = function (config) {
|
|
86
115
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -127,11 +156,10 @@ var MCPClient = /** @class */ (function () {
|
|
|
127
156
|
});
|
|
128
157
|
};
|
|
129
158
|
/**
|
|
130
|
-
*
|
|
159
|
+
* Returns the Tool Definitions discovered during the `connect()` phase.
|
|
131
160
|
*
|
|
132
|
-
*
|
|
133
|
-
*
|
|
134
|
-
* This method returns an empty array if not connected.
|
|
161
|
+
* This maps the raw MCP Tool format into Arvo's `AgentToolDefinition` structure
|
|
162
|
+
* so they can be injected into the LLM's context window.
|
|
135
163
|
*/
|
|
136
164
|
MCPClient.prototype.getTools = function (config) {
|
|
137
165
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -173,12 +201,13 @@ var MCPClient = /** @class */ (function () {
|
|
|
173
201
|
});
|
|
174
202
|
};
|
|
175
203
|
/**
|
|
176
|
-
*
|
|
204
|
+
* Executes a tool on the remote MCP Server.
|
|
177
205
|
*
|
|
178
|
-
*
|
|
179
|
-
*
|
|
180
|
-
*
|
|
181
|
-
*
|
|
206
|
+
* Wraps the execution in a dedicated OpenTelemetry Child Span (`MCP.invoke<tool_name>`)
|
|
207
|
+
* to track latency and success/failure rates of the external system.
|
|
208
|
+
*
|
|
209
|
+
* @param param - The tool name and argument payload generated by the LLM.
|
|
210
|
+
* @returns The simplified JSON string result to be fed back to the LLM.
|
|
182
211
|
*/
|
|
183
212
|
MCPClient.prototype.invokeTool = function (param, config) {
|
|
184
213
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -245,11 +274,8 @@ var MCPClient = /** @class */ (function () {
|
|
|
245
274
|
});
|
|
246
275
|
};
|
|
247
276
|
/**
|
|
248
|
-
*
|
|
249
|
-
*
|
|
250
|
-
* This method safely closes the connection to the MCP server if one exists,
|
|
251
|
-
* resets the connection state, and clears cached data. It's safe to call
|
|
252
|
-
* multiple times - subsequent calls will be no-ops if already disconnected.
|
|
277
|
+
* Terminates the transport session and resets clients state.
|
|
278
|
+
* Safe to call multiple times (idempotent).
|
|
253
279
|
*/
|
|
254
280
|
MCPClient.prototype.disconnect = function (config) {
|
|
255
281
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -279,10 +305,15 @@ var MCPClient = /** @class */ (function () {
|
|
|
279
305
|
});
|
|
280
306
|
});
|
|
281
307
|
};
|
|
308
|
+
/**
|
|
309
|
+
* Retrieves the priority configuration for MCP Tools.
|
|
310
|
+
*
|
|
311
|
+
* This allows external MCP tools to explicitly participate in Arvo's **Priority Batch Execution**.
|
|
312
|
+
*/
|
|
282
313
|
MCPClient.prototype.getToolPriority = function () {
|
|
283
314
|
return __awaiter(this, void 0, void 0, function () {
|
|
284
315
|
return __generator(this, function (_a) {
|
|
285
|
-
return [2 /*return*/,
|
|
316
|
+
return [2 /*return*/, this.toolPriority()];
|
|
286
317
|
});
|
|
287
318
|
});
|
|
288
319
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MCPClient.js","sourceRoot":"","sources":["../../src/Integrations/MCPClient.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,sEAAmE;AACnE,kEAA6E;AAC7E,wFAAmG;AAEnG,0CAAoD;AACpD,uCAMmB;AAInB
|
|
1
|
+
{"version":3,"file":"MCPClient.js","sourceRoot":"","sources":["../../src/Integrations/MCPClient.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,sEAAmE;AACnE,kEAA6E;AAC7E,wFAAmG;AAEnG,0CAAoD;AACpD,uCAMmB;AAInB;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH;IAQE;;;;;;;;;OASG;IACH,mBACE,KAE6F;QAE7F,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;QACnB,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC;QACzB,IAAI,CAAC,cAAc,GAAG,EAAE,CAAC;QACzB,IAAI,CAAC,GAAG,GAAG,cAAM,OAAA,CAAC,OAAO,KAAK,KAAK,UAAU,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,GAAG,EAAnD,CAAmD,CAAC;QACrE,IAAI,CAAC,WAAW,GAAG,sBAAM,OAAA,MAAA,CAAC,OAAO,KAAK,KAAK,UAAU,CAAC,CAAC,CAAC,KAAK,EAAE,CA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