@mondaydotcomorg/atp-client 0.19.20 → 0.20.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/index.cjs +46 -27
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +43 -28
- package/dist/index.js.map +1 -1
- package/dist/tools/explore-api.d.ts +3 -3
- package/dist/tools/explore-api.d.ts.map +1 -1
- package/dist/tools/explore-api.js +39 -30
- package/dist/tools/explore-api.js.map +1 -1
- package/package.json +3 -3
- package/src/index.ts +4 -0
- package/src/tools/explore-api.ts +59 -43
|
@@ -2,11 +2,11 @@ import { z } from 'zod';
|
|
|
2
2
|
import type { AgentToolProtocolClient } from '../client.js';
|
|
3
3
|
import { type Tool } from './types.js';
|
|
4
4
|
export declare const exploreApiInputSchema: z.ZodObject<{
|
|
5
|
-
|
|
5
|
+
paths: z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>;
|
|
6
6
|
}, "strip", z.ZodTypeAny, {
|
|
7
|
-
|
|
7
|
+
paths: string | string[];
|
|
8
8
|
}, {
|
|
9
|
-
|
|
9
|
+
paths: string | string[];
|
|
10
10
|
}>;
|
|
11
11
|
type ExploreApiInput = z.infer<typeof exploreApiInputSchema>;
|
|
12
12
|
export declare function createExploreApiTool(client: AgentToolProtocolClient): Tool<ExploreApiInput>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"explore-api.d.ts","sourceRoot":"","sources":["../../src/tools/explore-api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AAC5D,OAAO,EAAa,KAAK,IAAI,EAAE,MAAM,YAAY,CAAC;AAElD,eAAO,MAAM,qBAAqB;;;;;;
|
|
1
|
+
{"version":3,"file":"explore-api.d.ts","sourceRoot":"","sources":["../../src/tools/explore-api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AAC5D,OAAO,EAAa,KAAK,IAAI,EAAE,MAAM,YAAY,CAAC;AAElD,eAAO,MAAM,qBAAqB;;;;;;EAMhC,CAAC;AAEH,KAAK,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAkB7D,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,uBAAuB,GAAG,IAAI,CAAC,eAAe,CAAC,CA+C3F"}
|
|
@@ -2,45 +2,54 @@ import { z } from 'zod';
|
|
|
2
2
|
import { zodToJsonSchema } from 'zod-to-json-schema';
|
|
3
3
|
import { ToolNames } from './types.js';
|
|
4
4
|
export const exploreApiInputSchema = z.object({
|
|
5
|
-
|
|
6
|
-
.string()
|
|
7
|
-
.describe('Path to explore
|
|
5
|
+
paths: z
|
|
6
|
+
.union([z.string(), z.array(z.string()).min(1)])
|
|
7
|
+
.describe('Path(s) to explore. Can be a single string like "/" or an array like ["/openapi/github", "/mcp/filesystem"]'),
|
|
8
8
|
});
|
|
9
|
+
function normalizePaths(paths) {
|
|
10
|
+
return Array.isArray(paths) ? paths : [paths];
|
|
11
|
+
}
|
|
9
12
|
export function createExploreApiTool(client) {
|
|
10
13
|
return {
|
|
11
14
|
name: ToolNames.EXPLORE_API,
|
|
12
|
-
description: 'Explore APIs using filesystem-like navigation. Navigate through directories to discover available functions. Provide path as string like "/"
|
|
15
|
+
description: 'Explore APIs using filesystem-like navigation. Navigate through directories to discover available functions. Provide path as a string like "/" or paths as an array like ["/openapi", "/mcp"] to explore multiple at once.',
|
|
13
16
|
inputSchema: zodToJsonSchema(exploreApiInputSchema),
|
|
14
17
|
zodSchema: exploreApiInputSchema,
|
|
15
18
|
func: async (input) => {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
19
|
+
const pathsToExplore = normalizePaths(input.paths);
|
|
20
|
+
const results = await Promise.all(pathsToExplore.map(async (path) => {
|
|
21
|
+
try {
|
|
22
|
+
const result = await client.exploreAPI(path);
|
|
23
|
+
if (result.type === 'directory') {
|
|
24
|
+
return {
|
|
25
|
+
success: true,
|
|
26
|
+
type: 'directory',
|
|
27
|
+
path: result.path,
|
|
28
|
+
items: result.items,
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
return {
|
|
33
|
+
success: true,
|
|
34
|
+
type: 'function',
|
|
35
|
+
name: result.name,
|
|
36
|
+
description: result.description,
|
|
37
|
+
definition: result.definition,
|
|
38
|
+
group: result.group,
|
|
39
|
+
path: result.path,
|
|
40
|
+
};
|
|
41
|
+
}
|
|
25
42
|
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
group: result.group,
|
|
34
|
-
path: result.path,
|
|
35
|
-
}, null, 2);
|
|
43
|
+
catch (error) {
|
|
44
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
45
|
+
return {
|
|
46
|
+
success: false,
|
|
47
|
+
path,
|
|
48
|
+
error: message,
|
|
49
|
+
};
|
|
36
50
|
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
return JSON.stringify({
|
|
40
|
-
success: false,
|
|
41
|
-
error: error.message,
|
|
42
|
-
}, null, 2);
|
|
43
|
-
}
|
|
51
|
+
}));
|
|
52
|
+
return JSON.stringify(results, null, 2);
|
|
44
53
|
},
|
|
45
54
|
};
|
|
46
55
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"explore-api.js","sourceRoot":"","sources":["../../src/tools/explore-api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK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AAC,KAAK,EAAE,IAAI,EAAE,EAAE;gBACjC,IAAI,CAAC;oBACJ,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;oBAE7C,IAAI,MAAM,CAAC,IAAI,KAAK,WAAW,EAAE,CAAC;wBACjC,OAAO;4BACN,OAAO,EAAE,IAAI;4BACb,IAAI,EAAE,WAAoB;4BAC1B,IAAI,EAAE,MAAM,CAAC,IAAI;4BACjB,KAAK,EAAE,MAAM,CAAC,KAAK;yBACnB,CAAC;oBACH,CAAC;yBAAM,CAAC;wBACP,OAAO;4BACN,OAAO,EAAE,IAAI;4BACb,IAAI,EAAE,UAAmB;4BACzB,IAAI,EAAE,MAAM,CAAC,IAAI;4BACjB,WAAW,EAAE,MAAM,CAAC,WAAW;4BAC/B,UAAU,EAAE,MAAM,CAAC,UAAU;4BAC7B,KAAK,EAAE,MAAM,CAAC,KAAK;4BACnB,IAAI,EAAE,MAAM,CAAC,IAAI;yBACjB,CAAC;oBACH,CAAC;gBACF,CAAC;gBAAC,OAAO,KAAc,EAAE,CAAC;oBACzB,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;oBACvE,OAAO;wBACN,OAAO,EAAE,KAAK;wBACd,IAAI;wBACJ,KAAK,EAAE,OAAO;qBACd,CAAC;gBACH,CAAC;YACF,CAAC,CAAC,CACF,CAAC;YAEF,OAAO,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;QACzC,CAAC;KACD,CAAC;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mondaydotcomorg/atp-client",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.20.1",
|
|
4
4
|
"description": "Client SDK for Agent Tool Protocol",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -48,8 +48,8 @@
|
|
|
48
48
|
},
|
|
49
49
|
"license": "MIT",
|
|
50
50
|
"dependencies": {
|
|
51
|
-
"@mondaydotcomorg/atp-protocol": "0.19.
|
|
52
|
-
"@mondaydotcomorg/atp-runtime": "0.19.
|
|
51
|
+
"@mondaydotcomorg/atp-protocol": "0.19.20",
|
|
52
|
+
"@mondaydotcomorg/atp-runtime": "0.19.19",
|
|
53
53
|
"undici": "*",
|
|
54
54
|
"zod-to-json-schema": "^3.24.6"
|
|
55
55
|
},
|
package/src/index.ts
CHANGED
|
@@ -13,6 +13,10 @@ export {
|
|
|
13
13
|
executeCodeInputSchema,
|
|
14
14
|
exploreApiInputSchema,
|
|
15
15
|
fetchAllApisInputSchema,
|
|
16
|
+
createExploreApiTool,
|
|
17
|
+
createSearchApiTool,
|
|
18
|
+
createFetchAllApisTool,
|
|
19
|
+
createExecuteCodeTool,
|
|
16
20
|
} from './tools/index.js';
|
|
17
21
|
export type { AgentToolProtocolClientOptions } from './client.js';
|
|
18
22
|
export { InProcessSession } from './core/in-process-session.js';
|
package/src/tools/explore-api.ts
CHANGED
|
@@ -4,60 +4,76 @@ import type { AgentToolProtocolClient } from '../client.js';
|
|
|
4
4
|
import { ToolNames, type Tool } from './types.js';
|
|
5
5
|
|
|
6
6
|
export const exploreApiInputSchema = z.object({
|
|
7
|
-
|
|
8
|
-
.string()
|
|
9
|
-
.describe(
|
|
7
|
+
paths: z
|
|
8
|
+
.union([z.string(), z.array(z.string()).min(1)])
|
|
9
|
+
.describe(
|
|
10
|
+
'Path(s) to explore. Can be a single string like "/" or an array like ["/openapi/github", "/mcp/filesystem"]'
|
|
11
|
+
),
|
|
10
12
|
});
|
|
11
13
|
|
|
12
14
|
type ExploreApiInput = z.infer<typeof exploreApiInputSchema>;
|
|
13
15
|
|
|
16
|
+
interface ExploreResult {
|
|
17
|
+
success: boolean;
|
|
18
|
+
path: string;
|
|
19
|
+
type?: 'directory' | 'function';
|
|
20
|
+
items?: Array<{ name: string; type: string }>;
|
|
21
|
+
name?: string;
|
|
22
|
+
description?: string;
|
|
23
|
+
definition?: unknown;
|
|
24
|
+
group?: string;
|
|
25
|
+
error?: string;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function normalizePaths(paths: string | string[]): string[] {
|
|
29
|
+
return Array.isArray(paths) ? paths : [paths];
|
|
30
|
+
}
|
|
31
|
+
|
|
14
32
|
export function createExploreApiTool(client: AgentToolProtocolClient): Tool<ExploreApiInput> {
|
|
15
33
|
return {
|
|
16
34
|
name: ToolNames.EXPLORE_API,
|
|
17
35
|
description:
|
|
18
|
-
'Explore APIs using filesystem-like navigation. Navigate through directories to discover available functions. Provide path as string like "/"
|
|
36
|
+
'Explore APIs using filesystem-like navigation. Navigate through directories to discover available functions. Provide path as a string like "/" or paths as an array like ["/openapi", "/mcp"] to explore multiple at once.',
|
|
19
37
|
inputSchema: zodToJsonSchema(exploreApiInputSchema) as any,
|
|
20
38
|
zodSchema: exploreApiInputSchema,
|
|
21
39
|
func: async (input: ExploreApiInput) => {
|
|
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
|
-
}
|
|
40
|
+
const pathsToExplore = normalizePaths(input.paths);
|
|
41
|
+
|
|
42
|
+
const results: ExploreResult[] = await Promise.all(
|
|
43
|
+
pathsToExplore.map(async (path) => {
|
|
44
|
+
try {
|
|
45
|
+
const result = await client.exploreAPI(path);
|
|
46
|
+
|
|
47
|
+
if (result.type === 'directory') {
|
|
48
|
+
return {
|
|
49
|
+
success: true,
|
|
50
|
+
type: 'directory' as const,
|
|
51
|
+
path: result.path,
|
|
52
|
+
items: result.items,
|
|
53
|
+
};
|
|
54
|
+
} else {
|
|
55
|
+
return {
|
|
56
|
+
success: true,
|
|
57
|
+
type: 'function' as const,
|
|
58
|
+
name: result.name,
|
|
59
|
+
description: result.description,
|
|
60
|
+
definition: result.definition,
|
|
61
|
+
group: result.group,
|
|
62
|
+
path: result.path,
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
} catch (error: unknown) {
|
|
66
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
67
|
+
return {
|
|
68
|
+
success: false,
|
|
69
|
+
path,
|
|
70
|
+
error: message,
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
})
|
|
74
|
+
);
|
|
75
|
+
|
|
76
|
+
return JSON.stringify(results, null, 2);
|
|
61
77
|
},
|
|
62
78
|
};
|
|
63
79
|
}
|