@mcpjam/sdk 0.8.2 → 0.8.3
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/index.d.mts +4 -13
- package/dist/index.d.ts +4 -13
- package/dist/index.js +7 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +7 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -496,6 +496,7 @@ declare class MCPClientManager {
|
|
|
496
496
|
*/
|
|
497
497
|
getToolsForAiSdk(serverIds?: string[] | string, options?: {
|
|
498
498
|
schemas?: ToolSchemaOverrides | "automatic";
|
|
499
|
+
needsApproval?: boolean;
|
|
499
500
|
}): Promise<AiSdkTool>;
|
|
500
501
|
/**
|
|
501
502
|
* Executes a tool on a server.
|
|
@@ -531,15 +532,9 @@ declare class MCPClientManager {
|
|
|
531
532
|
type: "audio";
|
|
532
533
|
data: string;
|
|
533
534
|
mimeType: string;
|
|
534
|
-
annotations
|
|
535
|
-
/**
|
|
536
|
-
* Lists prompts available from a server.
|
|
537
|
-
*/
|
|
538
|
-
?: {
|
|
535
|
+
annotations?: {
|
|
539
536
|
audience?: ("user" | "assistant")[] | undefined;
|
|
540
|
-
priority
|
|
541
|
-
* Lists prompts available from a server.
|
|
542
|
-
*/: number | undefined;
|
|
537
|
+
priority?: number | undefined;
|
|
543
538
|
lastModified?: string | undefined;
|
|
544
539
|
} | undefined;
|
|
545
540
|
_meta?: Record<string, unknown> | undefined;
|
|
@@ -666,11 +661,7 @@ declare class MCPClientManager {
|
|
|
666
661
|
uri: string;
|
|
667
662
|
blob: string;
|
|
668
663
|
mimeType?: string | undefined;
|
|
669
|
-
_meta
|
|
670
|
-
/**
|
|
671
|
-
* Lists resources available from a server.
|
|
672
|
-
*/
|
|
673
|
-
?: Record<string, unknown> | undefined;
|
|
664
|
+
_meta?: Record<string, unknown> | undefined;
|
|
674
665
|
})[];
|
|
675
666
|
_meta?: {
|
|
676
667
|
[x: string]: unknown;
|
package/dist/index.d.ts
CHANGED
|
@@ -496,6 +496,7 @@ declare class MCPClientManager {
|
|
|
496
496
|
*/
|
|
497
497
|
getToolsForAiSdk(serverIds?: string[] | string, options?: {
|
|
498
498
|
schemas?: ToolSchemaOverrides | "automatic";
|
|
499
|
+
needsApproval?: boolean;
|
|
499
500
|
}): Promise<AiSdkTool>;
|
|
500
501
|
/**
|
|
501
502
|
* Executes a tool on a server.
|
|
@@ -531,15 +532,9 @@ declare class MCPClientManager {
|
|
|
531
532
|
type: "audio";
|
|
532
533
|
data: string;
|
|
533
534
|
mimeType: string;
|
|
534
|
-
annotations
|
|
535
|
-
/**
|
|
536
|
-
* Lists prompts available from a server.
|
|
537
|
-
*/
|
|
538
|
-
?: {
|
|
535
|
+
annotations?: {
|
|
539
536
|
audience?: ("user" | "assistant")[] | undefined;
|
|
540
|
-
priority
|
|
541
|
-
* Lists prompts available from a server.
|
|
542
|
-
*/: number | undefined;
|
|
537
|
+
priority?: number | undefined;
|
|
543
538
|
lastModified?: string | undefined;
|
|
544
539
|
} | undefined;
|
|
545
540
|
_meta?: Record<string, unknown> | undefined;
|
|
@@ -666,11 +661,7 @@ declare class MCPClientManager {
|
|
|
666
661
|
uri: string;
|
|
667
662
|
blob: string;
|
|
668
663
|
mimeType?: string | undefined;
|
|
669
|
-
_meta
|
|
670
|
-
/**
|
|
671
|
-
* Lists resources available from a server.
|
|
672
|
-
*/
|
|
673
|
-
?: Record<string, unknown> | undefined;
|
|
664
|
+
_meta?: Record<string, unknown> | undefined;
|
|
674
665
|
})[];
|
|
675
666
|
_meta?: {
|
|
676
667
|
[x: string]: unknown;
|
package/dist/index.js
CHANGED
|
@@ -585,7 +585,8 @@ function scrubMetaAndStructuredContentFromToolResult(result) {
|
|
|
585
585
|
}
|
|
586
586
|
async function convertMCPToolsToVercelTools(listToolsResult, {
|
|
587
587
|
schemas = "automatic",
|
|
588
|
-
callTool
|
|
588
|
+
callTool,
|
|
589
|
+
needsApproval
|
|
589
590
|
}) {
|
|
590
591
|
const tools = {};
|
|
591
592
|
for (const toolDescription of listToolsResult.tools) {
|
|
@@ -614,7 +615,8 @@ async function convertMCPToolsToVercelTools(listToolsResult, {
|
|
|
614
615
|
description,
|
|
615
616
|
inputSchema: ai.jsonSchema(normalizedInputSchema),
|
|
616
617
|
execute,
|
|
617
|
-
...toModelOutput ? { toModelOutput } : {}
|
|
618
|
+
...toModelOutput ? { toModelOutput } : {},
|
|
619
|
+
...needsApproval != null ? { needsApproval } : {}
|
|
618
620
|
});
|
|
619
621
|
} else {
|
|
620
622
|
const overrides = schemas;
|
|
@@ -625,7 +627,8 @@ async function convertMCPToolsToVercelTools(listToolsResult, {
|
|
|
625
627
|
description,
|
|
626
628
|
inputSchema: overrides[name].inputSchema,
|
|
627
629
|
execute,
|
|
628
|
-
...toModelOutput ? { toModelOutput } : {}
|
|
630
|
+
...toModelOutput ? { toModelOutput } : {},
|
|
631
|
+
...needsApproval != null ? { needsApproval } : {}
|
|
629
632
|
});
|
|
630
633
|
}
|
|
631
634
|
tools[name] = vercelTool;
|
|
@@ -900,6 +903,7 @@ var MCPClientManager = class {
|
|
|
900
903
|
const listToolsResult = await this.listTools(id);
|
|
901
904
|
const tools = await convertMCPToolsToVercelTools(listToolsResult, {
|
|
902
905
|
schemas: options.schemas,
|
|
906
|
+
needsApproval: options.needsApproval,
|
|
903
907
|
callTool: async ({ name, args, options: callOptions }) => {
|
|
904
908
|
const requestOptions = callOptions?.abortSignal ? { signal: callOptions.abortSignal } : void 0;
|
|
905
909
|
const result = await this.executeTool(
|