@mondaydotcomorg/atp-client 0.19.20 → 0.20.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.
@@ -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
- path: z.ZodString;
5
+ paths: z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>;
6
6
  }, "strip", z.ZodTypeAny, {
7
- path: string;
7
+ paths: string | string[];
8
8
  }, {
9
- path: string;
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;;;;;;EAIhC,CAAC;AAEH,KAAK,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAE7D,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,uBAAuB,GAAG,IAAI,CAAC,eAAe,CAAC,CAiD3F"}
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
- path: z
6
- .string()
7
- .describe('Path to explore (e.g., "/", "/openapi/github", "/mcp/filesystem/read_file")'),
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 "/", "/openapi", "/openapi/github", or "/openapi/github/repos/createRepo" to see functions.',
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
- try {
17
- const result = await client.exploreAPI(input.path);
18
- if (result.type === 'directory') {
19
- return JSON.stringify({
20
- success: true,
21
- type: 'directory',
22
- path: result.path,
23
- items: result.items,
24
- }, null, 2);
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
- else {
27
- return JSON.stringify({
28
- success: true,
29
- type: 'function',
30
- name: result.name,
31
- description: result.description,
32
- definition: result.definition,
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
- catch (error) {
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,CAAC;AACxB,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErD,OAAO,EAAE,SAAS,EAAa,MAAM,YAAY,CAAC;AAElD,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC7C,IAAI,EAAE,CAAC;SACL,MAAM,EAAE;SACR,QAAQ,CAAC,6EAA6E,CAAC;CACzF,CAAC,CAAC;AAIH,MAAM,UAAU,oBAAoB,CAAC,MAA+B;IACnE,OAAO;QACN,IAAI,EAAE,SAAS,CAAC,WAAW;QAC3B,WAAW,EACV,sOAAsO;QACvO,WAAW,EAAE,eAAe,CAAC,qBAAqB,CAAQ;QAC1D,SAAS,EAAE,qBAAqB;QAChC,IAAI,EAAE,KAAK,EAAE,KAAsB,EAAE,EAAE;YACtC,IAAI,CAAC;gBACJ,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;gBAEnD,IAAI,M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,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.19.20",
3
+ "version": "0.20.0",
4
4
  "description": "Client SDK for Agent Tool Protocol",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
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';
@@ -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
- path: z
8
- .string()
9
- .describe('Path to explore (e.g., "/", "/openapi/github", "/mcp/filesystem/read_file")'),
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 "/", "/openapi", "/openapi/github", or "/openapi/github/repos/createRepo" to see functions.',
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
- try {
23
- const result = await client.exploreAPI(input.path);
24
-
25
- if (result.type === 'directory') {
26
- return JSON.stringify(
27
- {
28
- success: true,
29
- type: 'directory',
30
- path: result.path,
31
- items: result.items,
32
- },
33
- null,
34
- 2
35
- );
36
- } else {
37
- return JSON.stringify(
38
- {
39
- success: true,
40
- type: 'function',
41
- name: result.name,
42
- description: result.description,
43
- definition: result.definition,
44
- group: result.group,
45
- path: result.path,
46
- },
47
- null,
48
- 2
49
- );
50
- }
51
- } catch (error: any) {
52
- return JSON.stringify(
53
- {
54
- success: false,
55
- error: error.message,
56
- },
57
- null,
58
- 2
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
  }