@mondaydotcomorg/atp-client 0.17.14

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.
Files changed (92) hide show
  1. package/README.md +397 -0
  2. package/dist/client.d.ts +125 -0
  3. package/dist/client.d.ts.map +1 -0
  4. package/dist/client.js +129 -0
  5. package/dist/client.js.map +1 -0
  6. package/dist/core/api-operations.d.ts +37 -0
  7. package/dist/core/api-operations.d.ts.map +1 -0
  8. package/dist/core/api-operations.js +90 -0
  9. package/dist/core/api-operations.js.map +1 -0
  10. package/dist/core/execution-operations.d.ts +34 -0
  11. package/dist/core/execution-operations.d.ts.map +1 -0
  12. package/dist/core/execution-operations.js +237 -0
  13. package/dist/core/execution-operations.js.map +1 -0
  14. package/dist/core/index.d.ts +8 -0
  15. package/dist/core/index.d.ts.map +1 -0
  16. package/dist/core/index.js +7 -0
  17. package/dist/core/index.js.map +1 -0
  18. package/dist/core/provenance-registry.d.ts +40 -0
  19. package/dist/core/provenance-registry.d.ts.map +1 -0
  20. package/dist/core/provenance-registry.js +108 -0
  21. package/dist/core/provenance-registry.js.map +1 -0
  22. package/dist/core/service-providers.d.ts +29 -0
  23. package/dist/core/service-providers.d.ts.map +1 -0
  24. package/dist/core/service-providers.js +139 -0
  25. package/dist/core/service-providers.js.map +1 -0
  26. package/dist/core/session.d.ts +50 -0
  27. package/dist/core/session.d.ts.map +1 -0
  28. package/dist/core/session.js +138 -0
  29. package/dist/core/session.js.map +1 -0
  30. package/dist/core/types.d.ts +73 -0
  31. package/dist/core/types.d.ts.map +1 -0
  32. package/dist/core/types.js +2 -0
  33. package/dist/core/types.js.map +1 -0
  34. package/dist/errors.d.ts +22 -0
  35. package/dist/errors.d.ts.map +1 -0
  36. package/dist/errors.js +25 -0
  37. package/dist/errors.js.map +1 -0
  38. package/dist/generator.d.ts +7 -0
  39. package/dist/generator.d.ts.map +1 -0
  40. package/dist/generator.js +12 -0
  41. package/dist/generator.js.map +1 -0
  42. package/dist/index.d.ts +10 -0
  43. package/dist/index.d.ts.map +1 -0
  44. package/dist/index.js +8 -0
  45. package/dist/index.js.map +1 -0
  46. package/dist/tools/execute-code.d.ts +20 -0
  47. package/dist/tools/execute-code.d.ts.map +1 -0
  48. package/dist/tools/execute-code.js +57 -0
  49. package/dist/tools/execute-code.js.map +1 -0
  50. package/dist/tools/explore-api.d.ts +14 -0
  51. package/dist/tools/explore-api.d.ts.map +1 -0
  52. package/dist/tools/explore-api.js +47 -0
  53. package/dist/tools/explore-api.js.map +1 -0
  54. package/dist/tools/fetch-all-apis.d.ts +14 -0
  55. package/dist/tools/fetch-all-apis.d.ts.map +1 -0
  56. package/dist/tools/fetch-all-apis.js +31 -0
  57. package/dist/tools/fetch-all-apis.js.map +1 -0
  58. package/dist/tools/index.d.ts +6 -0
  59. package/dist/tools/index.d.ts.map +1 -0
  60. package/dist/tools/index.js +6 -0
  61. package/dist/tools/index.js.map +1 -0
  62. package/dist/tools/search-api.d.ts +14 -0
  63. package/dist/tools/search-api.d.ts.map +1 -0
  64. package/dist/tools/search-api.js +36 -0
  65. package/dist/tools/search-api.js.map +1 -0
  66. package/dist/tools/types.d.ts +23 -0
  67. package/dist/tools/types.d.ts.map +1 -0
  68. package/dist/tools/types.js +7 -0
  69. package/dist/tools/types.js.map +1 -0
  70. package/dist/tools.d.ts +8 -0
  71. package/dist/tools.d.ts.map +1 -0
  72. package/dist/tools.js +14 -0
  73. package/dist/tools.js.map +1 -0
  74. package/package.json +46 -0
  75. package/src/client.ts +194 -0
  76. package/src/core/api-operations.ts +130 -0
  77. package/src/core/execution-operations.ts +301 -0
  78. package/src/core/index.ts +13 -0
  79. package/src/core/provenance-registry.ts +129 -0
  80. package/src/core/service-providers.ts +176 -0
  81. package/src/core/session.ts +180 -0
  82. package/src/core/types.ts +79 -0
  83. package/src/errors.ts +24 -0
  84. package/src/generator.ts +15 -0
  85. package/src/index.ts +10 -0
  86. package/src/tools/execute-code.ts +76 -0
  87. package/src/tools/explore-api.ts +63 -0
  88. package/src/tools/fetch-all-apis.ts +43 -0
  89. package/src/tools/index.ts +5 -0
  90. package/src/tools/search-api.ts +48 -0
  91. package/src/tools/types.ts +24 -0
  92. package/src/tools.ts +21 -0
@@ -0,0 +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,QAAA,MAAM,qBAAqB;;;;;;EAIzB,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"}
@@ -0,0 +1,47 @@
1
+ import { z } from 'zod';
2
+ import { zodToJsonSchema } from 'zod-to-json-schema';
3
+ import { ToolNames } from './types.js';
4
+ const exploreApiInputSchema = z.object({
5
+ path: z
6
+ .string()
7
+ .describe('Path to explore (e.g., "/", "/openapi/github", "/mcp/filesystem/read_file")'),
8
+ });
9
+ export function createExploreApiTool(client) {
10
+ return {
11
+ 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.',
13
+ inputSchema: zodToJsonSchema(exploreApiInputSchema),
14
+ zodSchema: exploreApiInputSchema,
15
+ 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);
25
+ }
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);
36
+ }
37
+ }
38
+ catch (error) {
39
+ return JSON.stringify({
40
+ success: false,
41
+ error: error.message,
42
+ }, null, 2);
43
+ }
44
+ },
45
+ };
46
+ }
47
+ //# sourceMappingURL=explore-api.js.map
@@ -0,0 +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,qBAAqB,GAAG,CAAC,CAAC,MAAM,CAAC;IACtC,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,MAAM,CAAC,IAAI,KAAK,WAAW,EAAE,CAAC;oBACjC,OAAO,IAAI,CAAC,SAAS,CACpB;wBACC,OAAO,EAAE,IAAI;wBACb,IAAI,EAAE,WAAW;wBACjB,IAAI,EAAE,MAAM,CAAC,IAAI;wBACjB,KAAK,EAAE,MAAM,CAAC,KAAK;qBACnB,EACD,IAAI,EACJ,CAAC,CACD,CAAC;gBACH,CAAC;qBAAM,CAAC;oBACP,OAAO,IAAI,CAAC,SAAS,CACpB;wBACC,OAAO,EAAE,IAAI;wBACb,IAAI,EAAE,UAAU;wBAChB,IAAI,EAAE,MAAM,CAAC,IAAI;wBACjB,WAAW,EAAE,MAAM,CAAC,WAAW;wBAC/B,UAAU,EAAE,MAAM,CAAC,UAAU;wBAC7B,KAAK,EAAE,MAAM,CAAC,KAAK;wBACnB,IAAI,EAAE,MAAM,CAAC,IAAI;qBACjB,EACD,IAAI,EACJ,CAAC,CACD,CAAC;gBACH,CAAC;YACF,CAAC;YAAC,OAAO,KAAU,EAAE,CAAC;gBACrB,OAAO,IAAI,CAAC,SAAS,CACpB;oBACC,OAAO,EAAE,KAAK;oBACd,KAAK,EAAE,KAAK,CAAC,OAAO;iBACpB,EACD,IAAI,EACJ,CAAC,CACD,CAAC;YACH,CAAC;QACF,CAAC;KACD,CAAC;AACH,CAAC"}
@@ -0,0 +1,14 @@
1
+ import { z } from 'zod';
2
+ import type { AgentToolProtocolClient } from '../client.js';
3
+ import { type Tool } from './types';
4
+ declare const fetchAllApisInputSchema: z.ZodObject<{
5
+ apiGroups: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
6
+ }, "strip", z.ZodTypeAny, {
7
+ apiGroups?: string[] | undefined;
8
+ }, {
9
+ apiGroups?: string[] | undefined;
10
+ }>;
11
+ type FetchAllApisInput = z.infer<typeof fetchAllApisInputSchema>;
12
+ export declare function createFetchAllApisTool(client: AgentToolProtocolClient): Tool<FetchAllApisInput>;
13
+ export {};
14
+ //# sourceMappingURL=fetch-all-apis.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fetch-all-apis.d.ts","sourceRoot":"","sources":["../../src/tools/fetch-all-apis.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,SAAS,CAAC;AAE/C,QAAA,MAAM,uBAAuB;;;;;;EAE3B,CAAC;AAEH,KAAK,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAEjE,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,uBAAuB,GAAG,IAAI,CAAC,iBAAiB,CAAC,CA+B/F"}
@@ -0,0 +1,31 @@
1
+ import { z } from 'zod';
2
+ import { zodToJsonSchema } from 'zod-to-json-schema';
3
+ import { ToolNames } from './types';
4
+ const fetchAllApisInputSchema = z.object({
5
+ apiGroups: z.array(z.string()).optional().describe('Optional: Specific API groups to include'),
6
+ });
7
+ export function createFetchAllApisTool(client) {
8
+ return {
9
+ name: ToolNames.FETCH_ALL_APIS,
10
+ description: 'Get TypeScript definitions of all available APIs. Returns code showing api.add, api.getTodo, etc.',
11
+ inputSchema: zodToJsonSchema(fetchAllApisInputSchema),
12
+ zodSchema: fetchAllApisInputSchema,
13
+ func: async (_input) => {
14
+ try {
15
+ const typescript = client.getTypeDefinitions();
16
+ return JSON.stringify({
17
+ success: true,
18
+ typescript,
19
+ message: 'Use this TypeScript to understand available api.* functions',
20
+ }, null, 2);
21
+ }
22
+ catch (error) {
23
+ return JSON.stringify({
24
+ success: false,
25
+ error: error.message,
26
+ }, null, 2);
27
+ }
28
+ },
29
+ };
30
+ }
31
+ //# sourceMappingURL=fetch-all-apis.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fetch-all-apis.js","sourceRoot":"","sources":["../../src/tools/fetch-all-apis.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,SAAS,CAAC;AAE/C,MAAM,uBAAuB,GAAG,CAAC,CAAC,MAAM,CAAC;IACxC,SAAS,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,0CAA0C,CAAC;CAC9F,CAAC,CAAC;AAIH,MAAM,UAAU,sBAAsB,CAAC,MAA+B;IACrE,OAAO;QACN,IAAI,EAAE,SAAS,CAAC,cAAc;QAC9B,WAAW,EACV,mGAAmG;QACpG,WAAW,EAAE,eAAe,CAAC,uBAAuB,CAAQ;QAC5D,SAAS,EAAE,uBAAuB;QAClC,IAAI,EAAE,KAAK,EAAE,MAAyB,EAAE,EAAE;YACzC,IAAI,CAAC;gBACJ,MAAM,UAAU,GAAG,MAAM,CAAC,kBAAkB,EAAE,CAAC;gBAC/C,OAAO,IAAI,CAAC,SAAS,CACpB;oBACC,OAAO,EAAE,IAAI;oBACb,UAAU;oBACV,OAAO,EAAE,6DAA6D;iBACtE,EACD,IAAI,EACJ,CAAC,CACD,CAAC;YACH,CAAC;YAAC,OAAO,KAAU,EAAE,CAAC;gBACrB,OAAO,IAAI,CAAC,SAAS,CACpB;oBACC,OAAO,EAAE,KAAK;oBACd,KAAK,EAAE,KAAK,CAAC,OAAO;iBACpB,EACD,IAAI,EACJ,CAAC,CACD,CAAC;YACH,CAAC;QACF,CAAC;KACD,CAAC;AACH,CAAC"}
@@ -0,0 +1,6 @@
1
+ export * from './types.js';
2
+ export * from './search-api.js';
3
+ export * from './fetch-all-apis.js';
4
+ export * from './execute-code.js';
5
+ export * from './explore-api.js';
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC"}
@@ -0,0 +1,6 @@
1
+ export * from './types.js';
2
+ export * from './search-api.js';
3
+ export * from './fetch-all-apis.js';
4
+ export * from './execute-code.js';
5
+ export * from './explore-api.js';
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC"}
@@ -0,0 +1,14 @@
1
+ import { z } from 'zod';
2
+ import type { AgentToolProtocolClient } from '../client.js';
3
+ import { type Tool } from './types';
4
+ declare const searchApiInputSchema: z.ZodObject<{
5
+ query: z.ZodString;
6
+ }, "strip", z.ZodTypeAny, {
7
+ query: string;
8
+ }, {
9
+ query: string;
10
+ }>;
11
+ type SearchApiInput = z.infer<typeof searchApiInputSchema>;
12
+ export declare function createSearchApiTool(client: AgentToolProtocolClient): Tool<SearchApiInput>;
13
+ export {};
14
+ //# sourceMappingURL=search-api.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"search-api.d.ts","sourceRoot":"","sources":["../../src/tools/search-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,SAAS,CAAC;AAE/C,QAAA,MAAM,oBAAoB;;;;;;EAExB,CAAC;AAEH,KAAK,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAE3D,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,uBAAuB,GAAG,IAAI,CAAC,cAAc,CAAC,CAoCzF"}
@@ -0,0 +1,36 @@
1
+ import { z } from 'zod';
2
+ import { zodToJsonSchema } from 'zod-to-json-schema';
3
+ import { ToolNames } from './types';
4
+ const searchApiInputSchema = z.object({
5
+ query: z.string().describe('Search query string'),
6
+ });
7
+ export function createSearchApiTool(client) {
8
+ return {
9
+ name: ToolNames.SEARCH_API,
10
+ description: 'Search for APIs by keyword. Provide search term as string like "add", "math", "user", etc.',
11
+ inputSchema: zodToJsonSchema(searchApiInputSchema),
12
+ zodSchema: searchApiInputSchema,
13
+ func: async (input) => {
14
+ try {
15
+ const results = await client.searchAPI(input.query);
16
+ return JSON.stringify({
17
+ success: true,
18
+ results: results.map((r) => ({
19
+ apiGroup: r.apiGroup,
20
+ functionName: r.functionName,
21
+ description: r.description,
22
+ signature: r.signature,
23
+ })),
24
+ count: results.length,
25
+ }, null, 2);
26
+ }
27
+ catch (error) {
28
+ return JSON.stringify({
29
+ success: false,
30
+ error: error.message,
31
+ }, null, 2);
32
+ }
33
+ },
34
+ };
35
+ }
36
+ //# sourceMappingURL=search-api.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"search-api.js","sourceRoot":"","sources":["../../src/tools/search-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,SAAS,CAAC;AAE/C,MAAM,oBAAoB,GAAG,CAAC,CAAC,MAAM,CAAC;IACrC,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,qBAAqB,CAAC;CACjD,CAAC,CAAC;AAIH,MAAM,UAAU,mBAAmB,CAAC,MAA+B;IAClE,OAAO;QACN,IAAI,EAAE,SAAS,CAAC,UAAU;QAC1B,WAAW,EACV,4FAA4F;QAC7F,WAAW,EAAE,eAAe,CAAC,oBAAoB,CAAQ;QACzD,SAAS,EAAE,oBAAoB;QAC/B,IAAI,EAAE,KAAK,EAAE,KAAqB,EAAE,EAAE;YACrC,IAAI,CAAC;gBACJ,MAAM,OAAO,GAAG,MAAM,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;gBACpD,OAAO,IAAI,CAAC,SAAS,CACpB;oBACC,OAAO,EAAE,IAAI;oBACb,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;wBAC5B,QAAQ,EAAE,CAAC,CAAC,QAAQ;wBACpB,YAAY,EAAE,CAAC,CAAC,YAAY;wBAC5B,WAAW,EAAE,CAAC,CAAC,WAAW;wBAC1B,SAAS,EAAE,CAAC,CAAC,SAAS;qBACtB,CAAC,CAAC;oBACH,KAAK,EAAE,OAAO,CAAC,MAAM;iBACrB,EACD,IAAI,EACJ,CAAC,CACD,CAAC;YACH,CAAC;YAAC,OAAO,KAAU,EAAE,CAAC;gBACrB,OAAO,IAAI,CAAC,SAAS,CACpB;oBACC,OAAO,EAAE,KAAK;oBACd,KAAK,EAAE,KAAK,CAAC,OAAO;iBACpB,EACD,IAAI,EACJ,CAAC,CACD,CAAC;YACH,CAAC;QACF,CAAC;KACD,CAAC;AACH,CAAC"}
@@ -0,0 +1,23 @@
1
+ export declare const ToolNames: {
2
+ readonly SEARCH_API: "search_api";
3
+ readonly FETCH_ALL_APIS: "fetch_all_apis";
4
+ readonly EXECUTE_CODE: "execute_code";
5
+ readonly EXPLORE_API: "explore_api";
6
+ };
7
+ export type ToolName = (typeof ToolNames)[keyof typeof ToolNames];
8
+ /**
9
+ * Tool definition following MCP (Model Context Protocol) convention
10
+ * with added execution function
11
+ */
12
+ export interface Tool<TInput = any> {
13
+ name: string;
14
+ description?: string;
15
+ inputSchema: {
16
+ type: string;
17
+ properties?: Record<string, unknown>;
18
+ required?: string[];
19
+ };
20
+ zodSchema?: any;
21
+ func: (input: TInput) => Promise<string>;
22
+ }
23
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/tools/types.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,SAAS;;;;;CAKZ,CAAC;AAEX,MAAM,MAAM,QAAQ,GAAG,CAAC,OAAO,SAAS,CAAC,CAAC,MAAM,OAAO,SAAS,CAAC,CAAC;AAElE;;;GAGG;AACH,MAAM,WAAW,IAAI,CAAC,MAAM,GAAG,GAAG;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE;QACZ,IAAI,EAAE,MAAM,CAAC;QACb,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QACrC,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;KACpB,CAAC;IACF,SAAS,CAAC,EAAE,GAAG,CAAC;IAChB,IAAI,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;CACzC"}
@@ -0,0 +1,7 @@
1
+ export const ToolNames = {
2
+ SEARCH_API: 'search_api',
3
+ FETCH_ALL_APIS: 'fetch_all_apis',
4
+ EXECUTE_CODE: 'execute_code',
5
+ EXPLORE_API: 'explore_api',
6
+ };
7
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/tools/types.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,SAAS,GAAG;IACxB,UAAU,EAAE,YAAY;IACxB,cAAc,EAAE,gBAAgB;IAChC,YAAY,EAAE,cAAc;IAC5B,WAAW,EAAE,aAAa;CACjB,CAAC"}
@@ -0,0 +1,8 @@
1
+ import type { AgentToolProtocolClient } from './client.js';
2
+ import { type Tool } from './tools/index.js';
3
+ /**
4
+ * Creates MCP-compliant tool definitions with execution handlers
5
+ * These tools work with any LLM/agent framework
6
+ */
7
+ export declare function createToolsFromATPClient(client: AgentToolProtocolClient): Tool[];
8
+ //# sourceMappingURL=tools.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../src/tools.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAC3D,OAAO,EACN,KAAK,IAAI,EAKT,MAAM,kBAAkB,CAAC;AAE1B;;;GAGG;AACH,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,uBAAuB,GAAG,IAAI,EAAE,CAOhF"}
package/dist/tools.js ADDED
@@ -0,0 +1,14 @@
1
+ import { createSearchApiTool, createFetchAllApisTool, createExecuteCodeTool, createExploreApiTool, } from './tools/index.js';
2
+ /**
3
+ * Creates MCP-compliant tool definitions with execution handlers
4
+ * These tools work with any LLM/agent framework
5
+ */
6
+ export function createToolsFromATPClient(client) {
7
+ return [
8
+ createSearchApiTool(client),
9
+ createFetchAllApisTool(client),
10
+ createExecuteCodeTool(client),
11
+ createExploreApiTool(client),
12
+ ];
13
+ }
14
+ //# sourceMappingURL=tools.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tools.js","sourceRoot":"","sources":["../src/tools.ts"],"names":[],"mappings":"AACA,OAAO,EAEN,mBAAmB,EACnB,sBAAsB,EACtB,qBAAqB,EACrB,oBAAoB,GACpB,MAAM,kBAAkB,CAAC;AAE1B;;;GAGG;AACH,MAAM,UAAU,wBAAwB,CAAC,MAA+B;IACvE,OAAO;QACN,mBAAmB,CAAC,MAAM,CAAC;QAC3B,sBAAsB,CAAC,MAAM,CAAC;QAC9B,qBAAqB,CAAC,MAAM,CAAC;QAC7B,oBAAoB,CAAC,MAAM,CAAC;KAC5B,CAAC;AACH,CAAC"}
package/package.json ADDED
@@ -0,0 +1,46 @@
1
+ {
2
+ "name": "@mondaydotcomorg/atp-client",
3
+ "version": "0.17.14",
4
+ "description": "Client SDK for Agent Tool Protocol",
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./dist/index.js"
12
+ },
13
+ "./core": {
14
+ "types": "./dist/core/index.d.ts",
15
+ "import": "./dist/core/index.js"
16
+ }
17
+ },
18
+ "files": [
19
+ "dist",
20
+ "src"
21
+ ],
22
+ "scripts": {
23
+ "build": "tsc -p tsconfig.json",
24
+ "dev": "tsc -p tsconfig.json --watch",
25
+ "clean": "rm -rf dist *.tsbuildinfo",
26
+ "test": "vitest run",
27
+ "lint": "tsc --noEmit"
28
+ },
29
+ "keywords": [
30
+ "agent",
31
+ "protocol",
32
+ "client",
33
+ "ai",
34
+ "llm"
35
+ ],
36
+ "license": "MIT",
37
+ "dependencies": {
38
+ "@mondaydotcomorg/atp-protocol": "0.17.14",
39
+ "zod": "^3.23.8",
40
+ "zod-to-json-schema": "^3.24.6"
41
+ },
42
+ "devDependencies": {
43
+ "typescript": "^5.3.3",
44
+ "vitest": "^1.2.1"
45
+ }
46
+ }
package/src/client.ts ADDED
@@ -0,0 +1,194 @@
1
+ import type {
2
+ ExecutionResult,
3
+ ExecutionConfig,
4
+ SearchOptions,
5
+ SearchResult,
6
+ ClientTool,
7
+ ExploreResult,
8
+ } from '@mondaydotcomorg/atp-protocol';
9
+ import { CallbackType } from '@mondaydotcomorg/atp-protocol';
10
+ import {
11
+ type ClientLLMHandler,
12
+ type ClientApprovalHandler,
13
+ type ClientEmbeddingHandler,
14
+ type ClientServiceProviders,
15
+ type ClientHooks,
16
+ ClientSession,
17
+ APIOperations,
18
+ ExecutionOperations,
19
+ ServiceProviders,
20
+ } from './core/index.js';
21
+
22
+ /**
23
+ * Options for creating an AgentToolProtocolClient
24
+ */
25
+ export interface AgentToolProtocolClientOptions {
26
+ /** Base URL of the Agent Tool Protocol server */
27
+ baseUrl: string;
28
+ /** Optional headers for authentication (e.g., { Authorization: 'Bearer token' }) */
29
+ headers?: Record<string, string>;
30
+ /** Optional client-provided services (LLM, approval, embedding) */
31
+ serviceProviders?: ClientServiceProviders;
32
+ /** Optional hooks for intercepting and modifying client behavior */
33
+ hooks?: ClientHooks;
34
+ }
35
+
36
+ /**
37
+ * AgentToolProtocolClient provides a client interface for connecting to
38
+ * Agent Tool Protocol servers and executing code.
39
+ */
40
+ export class AgentToolProtocolClient {
41
+ private session: ClientSession;
42
+ private apiOps: APIOperations;
43
+ private execOps: ExecutionOperations;
44
+ private serviceProviders: ServiceProviders;
45
+
46
+ /**
47
+ * Creates a new client instance.
48
+ *
49
+ * @example
50
+ * ```typescript
51
+ * const client = new AgentToolProtocolClient({
52
+ * baseUrl: 'http://localhost:3333',
53
+ * headers: { Authorization: 'Bearer token' },
54
+ * hooks: {
55
+ * preRequest: async (context) => {
56
+ * const token = await refreshToken();
57
+ * return { headers: { ...context.currentHeaders, Authorization: `Bearer ${token}` } };
58
+ * }
59
+ * }
60
+ * });
61
+ * ```
62
+ */
63
+ constructor(options: AgentToolProtocolClientOptions) {
64
+ const { baseUrl, headers, serviceProviders, hooks } = options;
65
+ this.session = new ClientSession(baseUrl, headers, hooks);
66
+ this.serviceProviders = new ServiceProviders(serviceProviders);
67
+ this.apiOps = new APIOperations(this.session);
68
+ this.execOps = new ExecutionOperations(this.session, this.serviceProviders);
69
+ }
70
+
71
+ /**
72
+ * Initializes the client session with the server.
73
+ * Automatically registers any client-provided tools with the server.
74
+ */
75
+ async init(clientInfo?: { name?: string; version?: string; [key: string]: unknown }): Promise<{
76
+ clientId: string;
77
+ token: string;
78
+ expiresAt: number;
79
+ tokenRotateAt: number;
80
+ }> {
81
+ const toolDefinitions = this.serviceProviders.getToolDefinitions();
82
+ return await this.session.init(clientInfo, toolDefinitions);
83
+ }
84
+
85
+ /**
86
+ * Gets the unique client ID.
87
+ */
88
+ getClientId(): string {
89
+ return this.session.getClientId();
90
+ }
91
+
92
+ /**
93
+ * Provides an LLM implementation for server to use during execution.
94
+ */
95
+ provideLLM(handler: ClientLLMHandler): void {
96
+ this.serviceProviders.provideLLM(handler);
97
+ }
98
+
99
+ /**
100
+ * Provides an approval handler for server to request human approval.
101
+ */
102
+ provideApproval(handler: ClientApprovalHandler): void {
103
+ this.serviceProviders.provideApproval(handler);
104
+ }
105
+
106
+ /**
107
+ * Provides an embedding model for server to use.
108
+ */
109
+ provideEmbedding(handler: ClientEmbeddingHandler): void {
110
+ this.serviceProviders.provideEmbedding(handler);
111
+ }
112
+
113
+ /**
114
+ * Provides custom tools that execute on the client side.
115
+ * Note: Must be called before init() or re-initialize after calling this.
116
+ */
117
+ provideTools(tools: ClientTool[]): void {
118
+ this.serviceProviders.provideTools(tools);
119
+ }
120
+
121
+ /**
122
+ * Connects to the server and retrieves API definitions.
123
+ */
124
+ async connect(options?: { apiGroups?: string[] }): Promise<{
125
+ serverVersion: string;
126
+ capabilities: unknown;
127
+ apiGroups: string[];
128
+ }> {
129
+ return await this.apiOps.connect(options);
130
+ }
131
+
132
+ /**
133
+ * Gets the TypeScript type definitions for available APIs.
134
+ */
135
+ getTypeDefinitions(): string {
136
+ return this.apiOps.getTypeDefinitions();
137
+ }
138
+
139
+ /**
140
+ * Searches for available API functions.
141
+ */
142
+ async searchAPI(query: string, options?: SearchOptions): Promise<SearchResult[]> {
143
+ return await this.apiOps.searchAPI(query, options);
144
+ }
145
+
146
+ /**
147
+ * Explores the API filesystem at the given path.
148
+ */
149
+ async exploreAPI(path: string): Promise<ExploreResult> {
150
+ return await this.apiOps.exploreAPI(path);
151
+ }
152
+
153
+ /**
154
+ * Executes code on the server with real-time progress updates via SSE.
155
+ */
156
+ async executeStream(
157
+ code: string,
158
+ config?: Partial<ExecutionConfig>,
159
+ onProgress?: (message: string, fraction: number) => void
160
+ ): Promise<ExecutionResult> {
161
+ return await this.execOps.executeStream(code, config, onProgress);
162
+ }
163
+
164
+ /**
165
+ * Executes code on the server in a sandboxed environment.
166
+ */
167
+ async execute(code: string, config?: Partial<ExecutionConfig>): Promise<ExecutionResult> {
168
+ return await this.execOps.execute(code, config);
169
+ }
170
+
171
+ /**
172
+ * Resumes a paused execution with a callback result.
173
+ */
174
+ async resume(executionId: string, callbackResult: unknown): Promise<ExecutionResult> {
175
+ return await this.execOps.resume(executionId, callbackResult);
176
+ }
177
+
178
+ /**
179
+ * Handles a callback request from the server during execution.
180
+ */
181
+ async handleCallback(callbackType: CallbackType, payload: any): Promise<any> {
182
+ return await this.serviceProviders.handleCallback(callbackType, payload);
183
+ }
184
+
185
+ /**
186
+ * Gets information about the server.
187
+ */
188
+ async getServerInfo(): Promise<{
189
+ version: string;
190
+ capabilities: Record<string, boolean>;
191
+ }> {
192
+ return await this.apiOps.getServerInfo();
193
+ }
194
+ }
@@ -0,0 +1,130 @@
1
+ import type { SearchOptions, SearchResult, ExploreResult } from '@mondaydotcomorg/atp-protocol';
2
+ import type { ClientSession } from './session.js';
3
+
4
+ export class APIOperations {
5
+ private session: ClientSession;
6
+ private apiDefinitions?: string;
7
+
8
+ constructor(session: ClientSession) {
9
+ this.session = session;
10
+ }
11
+
12
+ /**
13
+ * Connects to the server and retrieves API definitions.
14
+ */
15
+ async connect(options?: { apiGroups?: string[] }): Promise<{
16
+ serverVersion: string;
17
+ capabilities: unknown;
18
+ apiGroups: string[];
19
+ }> {
20
+ await this.session.ensureInitialized();
21
+
22
+ const params = new URLSearchParams();
23
+ if (options?.apiGroups) {
24
+ params.set('apiGroups', options.apiGroups.join(','));
25
+ }
26
+
27
+ const url = `${this.session.getBaseUrl()}/api/definitions?${params}`;
28
+ const headers = await this.session.prepareHeaders('GET', url);
29
+
30
+ const response = await fetch(url, { headers });
31
+
32
+ if (!response.ok) {
33
+ throw new Error(`Connection failed: ${response.status} ${response.statusText}`);
34
+ }
35
+
36
+ const data = (await response.json()) as {
37
+ typescript: string;
38
+ version: string;
39
+ apiGroups: string[];
40
+ };
41
+ this.apiDefinitions = data.typescript;
42
+
43
+ return {
44
+ serverVersion: data.version,
45
+ capabilities: {},
46
+ apiGroups: data.apiGroups,
47
+ };
48
+ }
49
+
50
+ /**
51
+ * Gets the TypeScript type definitions for available APIs.
52
+ */
53
+ getTypeDefinitions(): string {
54
+ if (!this.apiDefinitions) {
55
+ throw new Error('Not connected. Call connect() first.');
56
+ }
57
+ return this.apiDefinitions;
58
+ }
59
+
60
+ /**
61
+ * Searches for available API functions.
62
+ */
63
+ async searchAPI(query: string, options?: SearchOptions): Promise<SearchResult[]> {
64
+ await this.session.ensureInitialized();
65
+
66
+ const url = `${this.session.getBaseUrl()}/api/search`;
67
+ const body = JSON.stringify({ query, ...options });
68
+ const headers = await this.session.prepareHeaders('POST', url, body);
69
+
70
+ const response = await fetch(url, {
71
+ method: 'POST',
72
+ headers,
73
+ body,
74
+ });
75
+
76
+ if (!response.ok) {
77
+ throw new Error(`Search failed: ${response.status} ${response.statusText}`);
78
+ }
79
+
80
+ const data = (await response.json()) as { results: SearchResult[] };
81
+ return data.results;
82
+ }
83
+
84
+ /**
85
+ * Explores the API filesystem at the given path.
86
+ */
87
+ async exploreAPI(path: string): Promise<ExploreResult> {
88
+ await this.session.ensureInitialized();
89
+
90
+ const url = `${this.session.getBaseUrl()}/api/explore`;
91
+ const body = JSON.stringify({ path });
92
+ const headers = await this.session.prepareHeaders('POST', url, body);
93
+
94
+ const response = await fetch(url, {
95
+ method: 'POST',
96
+ headers,
97
+ body,
98
+ });
99
+
100
+ if (!response.ok) {
101
+ throw new Error(`Explore failed: ${response.status} ${response.statusText}`);
102
+ }
103
+
104
+ return (await response.json()) as ExploreResult;
105
+ }
106
+
107
+ /**
108
+ * Gets information about the server.
109
+ */
110
+ async getServerInfo(): Promise<{
111
+ version: string;
112
+ capabilities: Record<string, boolean>;
113
+ }> {
114
+ await this.session.ensureInitialized();
115
+
116
+ const url = `${this.session.getBaseUrl()}/api/info`;
117
+ const headers = await this.session.prepareHeaders('GET', url);
118
+
119
+ const response = await fetch(url, { headers });
120
+
121
+ if (!response.ok) {
122
+ throw new Error(`Failed to get server info: ${response.status}`);
123
+ }
124
+
125
+ return (await response.json()) as {
126
+ version: string;
127
+ capabilities: Record<string, boolean>;
128
+ };
129
+ }
130
+ }