@rnsk/toolkits 0.0.4 → 0.0.6
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/README.md +13 -8
- package/dist/core/index.d.ts +1 -1
- package/dist/core/types.d.ts +43 -1
- package/dist/core/validate.d.ts +1 -1
- package/dist/core/validate.js +14 -2
- package/dist/index.d.ts +5 -1
- package/dist/index.js +9 -1
- package/dist/toolkits/aws/icon.d.ts +5 -0
- package/dist/toolkits/aws/icon.js +41 -0
- package/dist/toolkits/aws/manifest.d.ts +3 -0
- package/dist/toolkits/aws/manifest.js +27 -0
- package/dist/toolkits/aws/tools/client.d.ts +13 -0
- package/dist/toolkits/aws/tools/client.js +25 -0
- package/dist/toolkits/aws/tools/cloudwatch/filter-log-events.d.ts +26 -0
- package/dist/toolkits/aws/tools/cloudwatch/filter-log-events.js +45 -0
- package/dist/toolkits/aws/tools/cloudwatch/get-metric-data.d.ts +35 -0
- package/dist/toolkits/aws/tools/cloudwatch/get-metric-data.js +62 -0
- package/dist/toolkits/aws/tools/cloudwatch/list-alarms.d.ts +29 -0
- package/dist/toolkits/aws/tools/cloudwatch/list-alarms.js +46 -0
- package/dist/toolkits/aws/tools/cloudwatch/list-log-groups.d.ts +25 -0
- package/dist/toolkits/aws/tools/cloudwatch/list-log-groups.js +38 -0
- package/dist/toolkits/aws/tools/ec2/get-instance.d.ts +65 -0
- package/dist/toolkits/aws/tools/ec2/get-instance.js +46 -0
- package/dist/toolkits/aws/tools/ec2/list-instances.d.ts +30 -0
- package/dist/toolkits/aws/tools/ec2/list-instances.js +46 -0
- package/dist/toolkits/aws/tools/ec2/start-instance.d.ts +24 -0
- package/dist/toolkits/aws/tools/ec2/start-instance.js +31 -0
- package/dist/toolkits/aws/tools/ec2/stop-instance.d.ts +24 -0
- package/dist/toolkits/aws/tools/ec2/stop-instance.js +31 -0
- package/dist/toolkits/aws/tools/index.d.ts +273 -0
- package/dist/toolkits/aws/tools/index.js +68 -0
- package/dist/toolkits/gcp/icon.d.ts +5 -0
- package/dist/toolkits/gcp/icon.js +5 -0
- package/dist/toolkits/gcp/manifest.d.ts +3 -0
- package/dist/toolkits/gcp/manifest.js +27 -0
- package/dist/toolkits/gcp/tools/client.d.ts +12 -0
- package/dist/toolkits/gcp/tools/client.js +24 -0
- package/dist/toolkits/gcp/tools/compute/get-instance.d.ts +36 -0
- package/dist/toolkits/gcp/tools/compute/get-instance.js +37 -0
- package/dist/toolkits/gcp/tools/compute/list-instances.d.ts +20 -0
- package/dist/toolkits/gcp/tools/compute/list-instances.js +62 -0
- package/dist/toolkits/gcp/tools/compute/start-instance.d.ts +27 -0
- package/dist/toolkits/gcp/tools/compute/start-instance.js +29 -0
- package/dist/toolkits/gcp/tools/compute/stop-instance.d.ts +27 -0
- package/dist/toolkits/gcp/tools/compute/stop-instance.js +29 -0
- package/dist/toolkits/gcp/tools/index.d.ts +162 -0
- package/dist/toolkits/gcp/tools/index.js +52 -0
- package/dist/toolkits/gcp/tools/monitoring/get-metrics.d.ts +26 -0
- package/dist/toolkits/gcp/tools/monitoring/get-metrics.js +53 -0
- package/dist/toolkits/gcp/tools/monitoring/list-metric-descriptors.d.ts +24 -0
- package/dist/toolkits/gcp/tools/monitoring/list-metric-descriptors.js +40 -0
- package/dist/toolkits/gmail/manifest.js +1 -1
- package/dist/toolkits/google-calendar/manifest.js +1 -6
- package/dist/toolkits/google-docs/icon.d.ts +5 -0
- package/dist/toolkits/google-docs/icon.js +6 -0
- package/dist/toolkits/google-docs/manifest.d.ts +3 -0
- package/dist/toolkits/google-docs/manifest.js +40 -0
- package/dist/toolkits/google-docs/tools/append-text.d.ts +30 -0
- package/dist/toolkits/google-docs/tools/append-text.js +48 -0
- package/dist/toolkits/google-docs/tools/copy-document.d.ts +27 -0
- package/dist/toolkits/google-docs/tools/copy-document.js +43 -0
- package/dist/toolkits/google-docs/tools/create-document.d.ts +26 -0
- package/dist/toolkits/google-docs/tools/create-document.js +39 -0
- package/dist/toolkits/google-docs/tools/delete-content.d.ts +28 -0
- package/dist/toolkits/google-docs/tools/delete-content.js +45 -0
- package/dist/toolkits/google-docs/tools/delete-document.d.ts +23 -0
- package/dist/toolkits/google-docs/tools/delete-document.js +30 -0
- package/dist/toolkits/google-docs/tools/get-document-text.d.ts +26 -0
- package/dist/toolkits/google-docs/tools/get-document-text.js +35 -0
- package/dist/toolkits/google-docs/tools/get-document.d.ts +5 -0
- package/dist/toolkits/google-docs/tools/get-document.js +29 -0
- package/dist/toolkits/google-docs/tools/index.d.ts +299 -0
- package/dist/toolkits/google-docs/tools/index.js +85 -0
- package/dist/toolkits/google-docs/tools/insert-text.d.ts +28 -0
- package/dist/toolkits/google-docs/tools/insert-text.js +39 -0
- package/dist/toolkits/google-docs/tools/list-documents.d.ts +21 -0
- package/dist/toolkits/google-docs/tools/list-documents.js +39 -0
- package/dist/toolkits/google-docs/tools/replace-text.d.ts +32 -0
- package/dist/toolkits/google-docs/tools/replace-text.js +48 -0
- package/dist/toolkits/google-docs/tools/utils.d.ts +12 -0
- package/dist/toolkits/google-docs/tools/utils.js +48 -0
- package/dist/toolkits/google-drive/icon.d.ts +5 -0
- package/dist/toolkits/google-drive/icon.js +6 -0
- package/dist/toolkits/google-drive/manifest.d.ts +3 -0
- package/dist/toolkits/google-drive/manifest.js +37 -0
- package/dist/toolkits/google-drive/tools/copy-file.d.ts +7 -0
- package/dist/toolkits/google-drive/tools/copy-file.js +41 -0
- package/dist/toolkits/google-drive/tools/create-folder.d.ts +6 -0
- package/dist/toolkits/google-drive/tools/create-folder.js +42 -0
- package/dist/toolkits/google-drive/tools/delete-file.d.ts +23 -0
- package/dist/toolkits/google-drive/tools/delete-file.js +30 -0
- package/dist/toolkits/google-drive/tools/download-file.d.ts +30 -0
- package/dist/toolkits/google-drive/tools/download-file.js +61 -0
- package/dist/toolkits/google-drive/tools/get-file.d.ts +5 -0
- package/dist/toolkits/google-drive/tools/get-file.js +31 -0
- package/dist/toolkits/google-drive/tools/index.d.ts +188 -0
- package/dist/toolkits/google-drive/tools/index.js +85 -0
- package/dist/toolkits/google-drive/tools/list-files.d.ts +21 -0
- package/dist/toolkits/google-drive/tools/list-files.js +42 -0
- package/dist/toolkits/google-drive/tools/move-file.d.ts +7 -0
- package/dist/toolkits/google-drive/tools/move-file.js +51 -0
- package/dist/toolkits/google-drive/tools/search-files.d.ts +21 -0
- package/dist/toolkits/google-drive/tools/search-files.js +36 -0
- package/dist/toolkits/google-drive/tools/update-file.d.ts +7 -0
- package/dist/toolkits/google-drive/tools/update-file.js +44 -0
- package/dist/toolkits/google-drive/tools/upload-file.d.ts +8 -0
- package/dist/toolkits/google-drive/tools/upload-file.js +58 -0
- package/dist/toolkits/google-sheets/manifest.js +1 -6
- package/package.json +22 -2
package/README.md
CHANGED
|
@@ -14,9 +14,9 @@ Manifest-driven toolkit registry for AI agents — connector definitions you pub
|
|
|
14
14
|
| `@rnsk/toolkits` | All toolkit manifests, `registerAllTools()`, `getAllTools()` |
|
|
15
15
|
| `@rnsk/toolkits/core` | Types, `defineToolkit`, validation, schema helpers |
|
|
16
16
|
|
|
17
|
-
## Seed toolkits (v0.0.
|
|
17
|
+
## Seed toolkits (v0.0.6)
|
|
18
18
|
|
|
19
|
-
**
|
|
19
|
+
**262 tools** across **12 toolkits**.
|
|
20
20
|
|
|
21
21
|
| Toolkit | Tools | Auth |
|
|
22
22
|
|---------|------:|------|
|
|
@@ -28,6 +28,10 @@ Manifest-driven toolkit registry for AI agents — connector definitions you pub
|
|
|
28
28
|
| notion | 8 | OAuth2 |
|
|
29
29
|
| google-calendar | 6 | OAuth2 |
|
|
30
30
|
| google-sheets | 7 | OAuth2 |
|
|
31
|
+
| google-drive | 10 | OAuth2 |
|
|
32
|
+
| google-docs | 10 | OAuth2 |
|
|
33
|
+
| aws | 8 | service account |
|
|
34
|
+
| gcp | 6 | service account |
|
|
31
35
|
|
|
32
36
|
## Install
|
|
33
37
|
|
|
@@ -71,25 +75,26 @@ Each toolkit lives under `src/toolkits/<id>/`:
|
|
|
71
75
|
tools/
|
|
72
76
|
*.ts # one tool per file (AI SDK tool() + execute)
|
|
73
77
|
index.ts # exports array
|
|
78
|
+
client.ts # optional: shared credential/SDK client helper (e.g. aws, gcp)
|
|
79
|
+
<group>/*.ts # optional: tools grouped into subfolders by service (e.g. github, aws, gcp)
|
|
74
80
|
```
|
|
75
81
|
|
|
76
82
|
After adding a toolkit, register it in `src/index.ts`, then run `npm run validate && npm run build`.
|
|
77
83
|
|
|
78
84
|
## Local testing
|
|
79
85
|
|
|
80
|
-
The repo includes a **sandbox** (not published to npm)
|
|
86
|
+
The repo includes a **sandbox** (not published to npm). It runs this package's source directly, so you don't need to build first. Test it through the real `@rnsk/bot` chat or a direct Tool runner, scoped to one toolkit:
|
|
81
87
|
|
|
82
88
|
```bash
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
npm run dev
|
|
89
|
+
# from the repo root
|
|
90
|
+
npm run sandbox # → http://localhost:5173
|
|
86
91
|
```
|
|
87
92
|
|
|
88
|
-
|
|
93
|
+
See [sandbox/README.md](../../sandbox/README.md).
|
|
89
94
|
|
|
90
95
|
## Versioning
|
|
91
96
|
|
|
92
|
-
Pre-1.0 (`0.0.x`): patch releases add toolkits and tools. Pin an exact version in production (`"0.0.
|
|
97
|
+
Pre-1.0 (`0.0.x`): patch releases add toolkits and tools. Pin an exact version in production (`"0.0.6"`).
|
|
93
98
|
|
|
94
99
|
## Contributing
|
|
95
100
|
|
package/dist/core/index.d.ts
CHANGED
|
@@ -3,5 +3,5 @@ export { defineToolkit, defineTool, toolkitCamelId } from './define.js';
|
|
|
3
3
|
export { inferToolScope } from './scope.js';
|
|
4
4
|
export { validateManifests, getAuthType, } from './validate.js';
|
|
5
5
|
export { TOOL_OUTPUT_JSON_SCHEMA, getToolInputZodSchema, resolveZodObjectShape, toolInputToJsonSchema, extractParameterInfo, coerceArguments, type ParameterInfo, } from './schema-helpers.js';
|
|
6
|
-
export type { ToolkitManifest, ToolDefinition, ToolkitIcon, ToolkitAuthSpec, ToolkitAuthType, ToolScope, OAuthProviderSpec, EnvVarSpec, ToolkitAvailability, } from './types.js';
|
|
6
|
+
export type { ToolkitManifest, ToolDefinition, ToolkitIcon, ToolkitAuthSpec, ToolkitAuthType, ToolScope, OAuthProviderSpec, ApiKeyProviderSpec, BasicAuthProviderSpec, BearerTokenProviderSpec, ServiceAccountProviderSpec, EnvVarSpec, ToolkitAvailability, } from './types.js';
|
|
7
7
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/core/types.d.ts
CHANGED
|
@@ -28,6 +28,26 @@ export interface OAuthProviderSpec {
|
|
|
28
28
|
stateCookie?: string;
|
|
29
29
|
tokenResponsePath?: string;
|
|
30
30
|
}
|
|
31
|
+
export interface ApiKeyProviderSpec {
|
|
32
|
+
/** Where the key is sent on outgoing requests; tool code attaches it itself. */
|
|
33
|
+
in: 'header' | 'query';
|
|
34
|
+
/** Header or query param name, e.g. 'X-API-Key' or 'api_key'. */
|
|
35
|
+
name: string;
|
|
36
|
+
/** Value prefix, e.g. 'Bearer' or 'Token'. Omit for a bare key. */
|
|
37
|
+
prefix?: string;
|
|
38
|
+
connectDescription: string;
|
|
39
|
+
}
|
|
40
|
+
export interface BasicAuthProviderSpec {
|
|
41
|
+
connectDescription: string;
|
|
42
|
+
}
|
|
43
|
+
export interface BearerTokenProviderSpec {
|
|
44
|
+
connectDescription: string;
|
|
45
|
+
}
|
|
46
|
+
export interface ServiceAccountProviderSpec {
|
|
47
|
+
/** Field names the connecting user must supply, e.g. ['accessKeyId', 'secretAccessKey']. */
|
|
48
|
+
fields: string[];
|
|
49
|
+
connectDescription: string;
|
|
50
|
+
}
|
|
31
51
|
export type ToolkitAuthSpec = {
|
|
32
52
|
type: 'none';
|
|
33
53
|
} | {
|
|
@@ -37,8 +57,30 @@ export type ToolkitAuthSpec = {
|
|
|
37
57
|
type: 'oauth2';
|
|
38
58
|
tokenField: string;
|
|
39
59
|
provider: OAuthProviderSpec;
|
|
60
|
+
} | {
|
|
61
|
+
type: 'api_key';
|
|
62
|
+
tokenField: string;
|
|
63
|
+
provider: ApiKeyProviderSpec;
|
|
64
|
+
}
|
|
65
|
+
/** Credential stored under tokenField as a raw 'username:password' string. */
|
|
66
|
+
| {
|
|
67
|
+
type: 'basic_auth';
|
|
68
|
+
tokenField: string;
|
|
69
|
+
provider: BasicAuthProviderSpec;
|
|
70
|
+
}
|
|
71
|
+
/** Always sent as 'Authorization: Bearer <token>'; tool code attaches it. */
|
|
72
|
+
| {
|
|
73
|
+
type: 'bearer_token';
|
|
74
|
+
tokenField: string;
|
|
75
|
+
provider: BearerTokenProviderSpec;
|
|
76
|
+
}
|
|
77
|
+
/** Credential stored under tokenField as a JSON object keyed by provider.fields. */
|
|
78
|
+
| {
|
|
79
|
+
type: 'service_account';
|
|
80
|
+
tokenField: string;
|
|
81
|
+
provider: ServiceAccountProviderSpec;
|
|
40
82
|
};
|
|
41
|
-
export type ToolkitAuthType = 'none' | 'oauth2' | 'service_env';
|
|
83
|
+
export type ToolkitAuthType = 'none' | 'oauth2' | 'service_env' | 'api_key' | 'basic_auth' | 'bearer_token' | 'service_account';
|
|
42
84
|
export interface ToolDefinition {
|
|
43
85
|
name: string;
|
|
44
86
|
description?: string;
|
package/dist/core/validate.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { ToolkitManifest } from './types.js';
|
|
2
2
|
export declare function validateManifests(manifests: ToolkitManifest[]): string[];
|
|
3
|
-
export declare function getAuthType(manifest: ToolkitManifest): 'OAUTH2' | 'None' | 'SERVICE_ENV';
|
|
3
|
+
export declare function getAuthType(manifest: ToolkitManifest): 'OAUTH2' | 'None' | 'SERVICE_ENV' | 'API_KEY' | 'BASIC_AUTH' | 'BEARER_TOKEN' | 'SERVICE_ACCOUNT';
|
|
4
4
|
//# sourceMappingURL=validate.d.ts.map
|
package/dist/core/validate.js
CHANGED
|
@@ -17,10 +17,14 @@ export function validateManifests(manifests) {
|
|
|
17
17
|
}
|
|
18
18
|
const camelId = toolkitCamelId(manifest.id);
|
|
19
19
|
const prefix = `${camelId[0].toUpperCase()}${camelId.slice(1)}`;
|
|
20
|
-
if (manifest.auth.type === 'oauth2'
|
|
20
|
+
if (manifest.auth.type === 'oauth2' ||
|
|
21
|
+
manifest.auth.type === 'api_key' ||
|
|
22
|
+
manifest.auth.type === 'basic_auth' ||
|
|
23
|
+
manifest.auth.type === 'bearer_token' ||
|
|
24
|
+
manifest.auth.type === 'service_account') {
|
|
21
25
|
const authedTools = manifest.tools.filter((t) => t.requiredAuth);
|
|
22
26
|
if (authedTools.length === 0) {
|
|
23
|
-
errors.push(
|
|
27
|
+
errors.push(`${manifest.auth.type} toolkit "${manifest.id}" has no tools with requiredAuth`);
|
|
24
28
|
}
|
|
25
29
|
for (const tool of manifest.tools) {
|
|
26
30
|
if (tool.requiredAuth && tool.requiredAuth !== manifest.auth.tokenField) {
|
|
@@ -52,6 +56,14 @@ export function getAuthType(manifest) {
|
|
|
52
56
|
return 'OAUTH2';
|
|
53
57
|
case 'service_env':
|
|
54
58
|
return 'SERVICE_ENV';
|
|
59
|
+
case 'api_key':
|
|
60
|
+
return 'API_KEY';
|
|
61
|
+
case 'basic_auth':
|
|
62
|
+
return 'BASIC_AUTH';
|
|
63
|
+
case 'bearer_token':
|
|
64
|
+
return 'BEARER_TOKEN';
|
|
65
|
+
case 'service_account':
|
|
66
|
+
return 'SERVICE_ACCOUNT';
|
|
55
67
|
default:
|
|
56
68
|
return 'None';
|
|
57
69
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -6,9 +6,13 @@ import github from './toolkits/github/manifest.js';
|
|
|
6
6
|
import notion from './toolkits/notion/manifest.js';
|
|
7
7
|
import googleCalendar from './toolkits/google-calendar/manifest.js';
|
|
8
8
|
import googleSheets from './toolkits/google-sheets/manifest.js';
|
|
9
|
+
import googleDrive from './toolkits/google-drive/manifest.js';
|
|
10
|
+
import googleDocs from './toolkits/google-docs/manifest.js';
|
|
11
|
+
import aws from './toolkits/aws/manifest.js';
|
|
12
|
+
import gcp from './toolkits/gcp/manifest.js';
|
|
9
13
|
import type { ToolkitManifest } from './core/types.js';
|
|
10
14
|
export declare const toolkits: ToolkitManifest[];
|
|
11
|
-
export { mathematics, linear, gmail, webSearch, github, notion, googleCalendar, googleSheets, };
|
|
15
|
+
export { mathematics, linear, gmail, webSearch, github, notion, googleCalendar, googleSheets, googleDrive, googleDocs, aws, gcp, };
|
|
12
16
|
export * from './core/index.js';
|
|
13
17
|
export declare function getAllTools(): {
|
|
14
18
|
name: string;
|
package/dist/index.js
CHANGED
|
@@ -6,6 +6,10 @@ import github from './toolkits/github/manifest.js';
|
|
|
6
6
|
import notion from './toolkits/notion/manifest.js';
|
|
7
7
|
import googleCalendar from './toolkits/google-calendar/manifest.js';
|
|
8
8
|
import googleSheets from './toolkits/google-sheets/manifest.js';
|
|
9
|
+
import googleDrive from './toolkits/google-drive/manifest.js';
|
|
10
|
+
import googleDocs from './toolkits/google-docs/manifest.js';
|
|
11
|
+
import aws from './toolkits/aws/manifest.js';
|
|
12
|
+
import gcp from './toolkits/gcp/manifest.js';
|
|
9
13
|
export const toolkits = [
|
|
10
14
|
mathematics,
|
|
11
15
|
linear,
|
|
@@ -15,8 +19,12 @@ export const toolkits = [
|
|
|
15
19
|
notion,
|
|
16
20
|
googleCalendar,
|
|
17
21
|
googleSheets,
|
|
22
|
+
googleDrive,
|
|
23
|
+
googleDocs,
|
|
24
|
+
aws,
|
|
25
|
+
gcp,
|
|
18
26
|
];
|
|
19
|
-
export { mathematics, linear, gmail, webSearch, github, notion, googleCalendar, googleSheets, };
|
|
27
|
+
export { mathematics, linear, gmail, webSearch, github, notion, googleCalendar, googleSheets, googleDrive, googleDocs, aws, gcp, };
|
|
20
28
|
export * from './core/index.js';
|
|
21
29
|
export function getAllTools() {
|
|
22
30
|
return toolkits.flatMap((t) => t.tools.map((toolDef) => ({
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
const SVG = `<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
|
2
|
+
viewBox="0 0 304 182" style="enable-background:new 0 0 304 182;" xml:space="preserve">
|
|
3
|
+
<style type="text/css">
|
|
4
|
+
.st0{fill:#252F3E;}
|
|
5
|
+
.st1{fill-rule:evenodd;clip-rule:evenodd;fill:#FF9900;}
|
|
6
|
+
</style>
|
|
7
|
+
<g>
|
|
8
|
+
<path class="st0" d="M86.4,66.4c0,3.7,0.4,6.7,1.1,8.9c0.8,2.2,1.8,4.6,3.2,7.2c0.5,0.8,0.7,1.6,0.7,2.3c0,1-0.6,2-1.9,3l-6.3,4.2
|
|
9
|
+
c-0.9,0.6-1.8,0.9-2.6,0.9c-1,0-2-0.5-3-1.4C76.2,90,75,88.4,74,86.8c-1-1.7-2-3.6-3.1-5.9c-7.8,9.2-17.6,13.8-29.4,13.8
|
|
10
|
+
c-8.4,0-15.1-2.4-20-7.2c-4.9-4.8-7.4-11.2-7.4-19.2c0-8.5,3-15.4,9.1-20.6c6.1-5.2,14.2-7.8,24.5-7.8c3.4,0,6.9,0.3,10.6,0.8
|
|
11
|
+
c3.7,0.5,7.5,1.3,11.5,2.2v-7.3c0-7.6-1.6-12.9-4.7-16c-3.2-3.1-8.6-4.6-16.3-4.6c-3.5,0-7.1,0.4-10.8,1.3c-3.7,0.9-7.3,2-10.8,3.4
|
|
12
|
+
c-1.6,0.7-2.8,1.1-3.5,1.3c-0.7,0.2-1.2,0.3-1.6,0.3c-1.4,0-2.1-1-2.1-3.1v-4.9c0-1.6,0.2-2.8,0.7-3.5c0.5-0.7,1.4-1.4,2.8-2.1
|
|
13
|
+
c3.5-1.8,7.7-3.3,12.6-4.5c4.9-1.3,10.1-1.9,15.6-1.9c11.9,0,20.6,2.7,26.2,8.1c5.5,5.4,8.3,13.6,8.3,24.6V66.4z M45.8,81.6
|
|
14
|
+
c3.3,0,6.7-0.6,10.3-1.8c3.6-1.2,6.8-3.4,9.5-6.4c1.6-1.9,2.8-4,3.4-6.4c0.6-2.4,1-5.3,1-8.7v-4.2c-2.9-0.7-6-1.3-9.2-1.7
|
|
15
|
+
c-3.2-0.4-6.3-0.6-9.4-0.6c-6.7,0-11.6,1.3-14.9,4c-3.3,2.7-4.9,6.5-4.9,11.5c0,4.7,1.2,8.2,3.7,10.6
|
|
16
|
+
C37.7,80.4,41.2,81.6,45.8,81.6z M126.1,92.4c-1.8,0-3-0.3-3.8-1c-0.8-0.6-1.5-2-2.1-3.9L96.7,10.2c-0.6-2-0.9-3.3-0.9-4
|
|
17
|
+
c0-1.6,0.8-2.5,2.4-2.5h9.8c1.9,0,3.2,0.3,3.9,1c0.8,0.6,1.4,2,2,3.9l16.8,66.2l15.6-66.2c0.5-2,1.1-3.3,1.9-3.9c0.8-0.6,2.2-1,4-1
|
|
18
|
+
h8c1.9,0,3.2,0.3,4,1c0.8,0.6,1.5,2,1.9,3.9l15.8,67l17.3-67c0.6-2,1.3-3.3,2-3.9c0.8-0.6,2.1-1,3.9-1h9.3c1.6,0,2.5,0.8,2.5,2.5
|
|
19
|
+
c0,0.5-0.1,1-0.2,1.6c-0.1,0.6-0.3,1.4-0.7,2.5l-24.1,77.3c-0.6,2-1.3,3.3-2.1,3.9c-0.8,0.6-2.1,1-3.8,1h-8.6c-1.9,0-3.2-0.3-4-1
|
|
20
|
+
c-0.8-0.7-1.5-2-1.9-4L156,23l-15.4,64.4c-0.5,2-1.1,3.3-1.9,4c-0.8,0.7-2.2,1-4,1H126.1z M254.6,95.1c-5.2,0-10.4-0.6-15.4-1.8
|
|
21
|
+
c-5-1.2-8.9-2.5-11.5-4c-1.6-0.9-2.7-1.9-3.1-2.8c-0.4-0.9-0.6-1.9-0.6-2.8v-5.1c0-2.1,0.8-3.1,2.3-3.1c0.6,0,1.2,0.1,1.8,0.3
|
|
22
|
+
c0.6,0.2,1.5,0.6,2.5,1c3.4,1.5,7.1,2.7,11,3.5c4,0.8,7.9,1.2,11.9,1.2c6.3,0,11.2-1.1,14.6-3.3c3.4-2.2,5.2-5.4,5.2-9.5
|
|
23
|
+
c0-2.8-0.9-5.1-2.7-7c-1.8-1.9-5.2-3.6-10.1-5.2L246,52c-7.3-2.3-12.7-5.7-16-10.2c-3.3-4.4-5-9.3-5-14.5c0-4.2,0.9-7.9,2.7-11.1
|
|
24
|
+
c1.8-3.2,4.2-6,7.2-8.2c3-2.3,6.4-4,10.4-5.2c4-1.2,8.2-1.7,12.6-1.7c2.2,0,4.5,0.1,6.7,0.4c2.3,0.3,4.4,0.7,6.5,1.1
|
|
25
|
+
c2,0.5,3.9,1,5.7,1.6c1.8,0.6,3.2,1.2,4.2,1.8c1.4,0.8,2.4,1.6,3,2.5c0.6,0.8,0.9,1.9,0.9,3.3v4.7c0,2.1-0.8,3.2-2.3,3.2
|
|
26
|
+
c-0.8,0-2.1-0.4-3.8-1.2c-5.7-2.6-12.1-3.9-19.2-3.9c-5.7,0-10.2,0.9-13.3,2.8c-3.1,1.9-4.7,4.8-4.7,8.9c0,2.8,1,5.2,3,7.1
|
|
27
|
+
c2,1.9,5.7,3.8,11,5.5l14.2,4.5c7.2,2.3,12.4,5.5,15.5,9.6c3.1,4.1,4.6,8.8,4.6,14c0,4.3-0.9,8.2-2.6,11.6
|
|
28
|
+
c-1.8,3.4-4.2,6.4-7.3,8.8c-3.1,2.5-6.8,4.3-11.1,5.6C264.4,94.4,259.7,95.1,254.6,95.1z"/>
|
|
29
|
+
<g>
|
|
30
|
+
<path class="st1" d="M273.5,143.7c-32.9,24.3-80.7,37.2-121.8,37.2c-57.6,0-109.5-21.3-148.7-56.7c-3.1-2.8-0.3-6.6,3.4-4.4
|
|
31
|
+
c42.4,24.6,94.7,39.5,148.8,39.5c36.5,0,76.6-7.6,113.5-23.2C274.2,133.6,278.9,139.7,273.5,143.7z"/>
|
|
32
|
+
<path class="st1" d="M287.2,128.1c-4.2-5.4-27.8-2.6-38.5-1.3c-3.2,0.4-3.7-2.4-0.8-4.5c18.8-13.2,49.7-9.4,53.3-5
|
|
33
|
+
c3.6,4.5-1,35.4-18.6,50.2c-2.7,2.3-5.3,1.1-4.1-1.9C282.5,155.7,291.4,133.4,287.2,128.1z"/>
|
|
34
|
+
</g>
|
|
35
|
+
</g>
|
|
36
|
+
</svg>`;
|
|
37
|
+
export const AWS_ICON = {
|
|
38
|
+
kind: 'svg',
|
|
39
|
+
dataUri: `data:image/svg+xml;base64,${Buffer.from(SVG).toString('base64')}`,
|
|
40
|
+
};
|
|
41
|
+
//# sourceMappingURL=icon.js.map
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { defineToolkit, defineTool } from '../../core/define.js';
|
|
2
|
+
import { AWS_ICON } from './icon.js';
|
|
3
|
+
import { awsTools } from './tools/index.js';
|
|
4
|
+
export default defineToolkit({
|
|
5
|
+
id: 'aws',
|
|
6
|
+
displayName: 'AWS',
|
|
7
|
+
shortDescription: 'Manage EC2 instances and monitor CloudWatch metrics, alarms, and logs.',
|
|
8
|
+
category: 'Developer Tools & DevOps',
|
|
9
|
+
icon: AWS_ICON,
|
|
10
|
+
auth: {
|
|
11
|
+
type: 'service_account',
|
|
12
|
+
tokenField: 'awsCredentials',
|
|
13
|
+
provider: {
|
|
14
|
+
fields: ['accessKeyId', 'secretAccessKey'],
|
|
15
|
+
connectDescription: 'Connect an AWS IAM access key with EC2 and CloudWatch read (and, for start/stop, write) permissions.',
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
tools: awsTools.map((entry) => defineTool({
|
|
19
|
+
name: entry.name,
|
|
20
|
+
description: entry.description,
|
|
21
|
+
tool: entry.tool,
|
|
22
|
+
requiredAuth: entry.requiredAuth,
|
|
23
|
+
scope: entry.scope,
|
|
24
|
+
})),
|
|
25
|
+
meta: { since: '0.0.6', homepage: 'https://aws.amazon.com' },
|
|
26
|
+
});
|
|
27
|
+
//# sourceMappingURL=manifest.js.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { EC2Client } from '@aws-sdk/client-ec2';
|
|
2
|
+
import { CloudWatchClient } from '@aws-sdk/client-cloudwatch';
|
|
3
|
+
import { CloudWatchLogsClient } from '@aws-sdk/client-cloudwatch-logs';
|
|
4
|
+
export interface AwsCredentials {
|
|
5
|
+
accessKeyId: string;
|
|
6
|
+
secretAccessKey: string;
|
|
7
|
+
}
|
|
8
|
+
/** awsCredentials is the JSON blob injected by the framework under the manifest's tokenField. */
|
|
9
|
+
export declare function parseAwsCredentials(awsCredentials: string): AwsCredentials;
|
|
10
|
+
export declare function createEc2Client(awsCredentials: string, region?: string): EC2Client;
|
|
11
|
+
export declare function createCloudWatchClient(awsCredentials: string, region?: string): CloudWatchClient;
|
|
12
|
+
export declare function createCloudWatchLogsClient(awsCredentials: string, region?: string): CloudWatchLogsClient;
|
|
13
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { EC2Client } from '@aws-sdk/client-ec2';
|
|
2
|
+
import { CloudWatchClient } from '@aws-sdk/client-cloudwatch';
|
|
3
|
+
import { CloudWatchLogsClient } from '@aws-sdk/client-cloudwatch-logs';
|
|
4
|
+
const DEFAULT_REGION = 'us-east-1';
|
|
5
|
+
/** awsCredentials is the JSON blob injected by the framework under the manifest's tokenField. */
|
|
6
|
+
export function parseAwsCredentials(awsCredentials) {
|
|
7
|
+
const parsed = JSON.parse(awsCredentials);
|
|
8
|
+
if (!parsed.accessKeyId || !parsed.secretAccessKey) {
|
|
9
|
+
throw new Error('AWS credentials must include accessKeyId and secretAccessKey');
|
|
10
|
+
}
|
|
11
|
+
return { accessKeyId: parsed.accessKeyId, secretAccessKey: parsed.secretAccessKey };
|
|
12
|
+
}
|
|
13
|
+
export function createEc2Client(awsCredentials, region) {
|
|
14
|
+
return new EC2Client({ region: region || DEFAULT_REGION, credentials: parseAwsCredentials(awsCredentials) });
|
|
15
|
+
}
|
|
16
|
+
export function createCloudWatchClient(awsCredentials, region) {
|
|
17
|
+
return new CloudWatchClient({ region: region || DEFAULT_REGION, credentials: parseAwsCredentials(awsCredentials) });
|
|
18
|
+
}
|
|
19
|
+
export function createCloudWatchLogsClient(awsCredentials, region) {
|
|
20
|
+
return new CloudWatchLogsClient({
|
|
21
|
+
region: region || DEFAULT_REGION,
|
|
22
|
+
credentials: parseAwsCredentials(awsCredentials),
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export declare const awsFilterCloudwatchLogEvents: import("ai").Tool<{
|
|
2
|
+
logGroupName: string;
|
|
3
|
+
limit?: number | undefined;
|
|
4
|
+
region?: string | undefined;
|
|
5
|
+
awsCredentials?: string | undefined;
|
|
6
|
+
startTime?: number | undefined;
|
|
7
|
+
endTime?: number | undefined;
|
|
8
|
+
filterPattern?: string | undefined;
|
|
9
|
+
}, {
|
|
10
|
+
error: string;
|
|
11
|
+
events?: undefined;
|
|
12
|
+
message?: undefined;
|
|
13
|
+
} | {
|
|
14
|
+
events: {
|
|
15
|
+
logStreamName: string | undefined;
|
|
16
|
+
timestamp: number | undefined;
|
|
17
|
+
message: string | undefined;
|
|
18
|
+
}[];
|
|
19
|
+
error?: undefined;
|
|
20
|
+
message?: undefined;
|
|
21
|
+
} | {
|
|
22
|
+
error: string;
|
|
23
|
+
message: string;
|
|
24
|
+
events?: undefined;
|
|
25
|
+
}>;
|
|
26
|
+
//# sourceMappingURL=filter-log-events.d.ts.map
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { tool } from 'ai';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { FilterLogEventsCommand } from '@aws-sdk/client-cloudwatch-logs';
|
|
4
|
+
import { createCloudWatchLogsClient } from '../client.js';
|
|
5
|
+
export const awsFilterCloudwatchLogEvents = tool({
|
|
6
|
+
description: 'Search log events in a CloudWatch log group using an optional filter pattern and time range. Useful for finding errors or specific messages in logs.',
|
|
7
|
+
inputSchema: z.object({
|
|
8
|
+
awsCredentials: z.string().optional().describe('Injected by system; do not provide'),
|
|
9
|
+
region: z.string().optional().describe('AWS region to query (default: us-east-1)'),
|
|
10
|
+
logGroupName: z.string().describe('The name of the CloudWatch log group to search'),
|
|
11
|
+
filterPattern: z.string().optional().describe('Filter pattern, e.g. "ERROR" or "?ERROR ?Exception"'),
|
|
12
|
+
startTime: z.number().optional().describe('Start time as a Unix timestamp in milliseconds'),
|
|
13
|
+
endTime: z.number().optional().describe('End time as a Unix timestamp in milliseconds'),
|
|
14
|
+
limit: z.number().min(1).max(200).optional().describe('Maximum number of log events to return (default 50)'),
|
|
15
|
+
}),
|
|
16
|
+
execute: async ({ awsCredentials, region, logGroupName, filterPattern, startTime, endTime, limit }) => {
|
|
17
|
+
if (!awsCredentials) {
|
|
18
|
+
return { error: 'AWS credentials are required. Connect AWS first.' };
|
|
19
|
+
}
|
|
20
|
+
try {
|
|
21
|
+
const client = createCloudWatchLogsClient(awsCredentials, region);
|
|
22
|
+
const response = await client.send(new FilterLogEventsCommand({
|
|
23
|
+
logGroupName,
|
|
24
|
+
filterPattern,
|
|
25
|
+
startTime,
|
|
26
|
+
endTime,
|
|
27
|
+
limit: limit ?? 50,
|
|
28
|
+
}));
|
|
29
|
+
return {
|
|
30
|
+
events: (response.events ?? []).map((event) => ({
|
|
31
|
+
logStreamName: event.logStreamName,
|
|
32
|
+
timestamp: event.timestamp,
|
|
33
|
+
message: event.message,
|
|
34
|
+
})),
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
catch (err) {
|
|
38
|
+
return {
|
|
39
|
+
error: 'Failed to filter CloudWatch log events',
|
|
40
|
+
message: err instanceof Error ? err.message : 'Unknown error',
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
});
|
|
45
|
+
//# sourceMappingURL=filter-log-events.js.map
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export declare const awsGetCloudwatchMetricData: import("ai").Tool<{
|
|
2
|
+
namespace: string;
|
|
3
|
+
metricName: string;
|
|
4
|
+
region?: string | undefined;
|
|
5
|
+
awsCredentials?: string | undefined;
|
|
6
|
+
dimensions?: Record<string, string> | undefined;
|
|
7
|
+
startTime?: string | undefined;
|
|
8
|
+
endTime?: string | undefined;
|
|
9
|
+
period?: number | undefined;
|
|
10
|
+
statistic?: "Average" | "Sum" | "Minimum" | "Maximum" | "SampleCount" | undefined;
|
|
11
|
+
}, {
|
|
12
|
+
error: string;
|
|
13
|
+
label?: undefined;
|
|
14
|
+
datapoints?: undefined;
|
|
15
|
+
message?: undefined;
|
|
16
|
+
} | {
|
|
17
|
+
label: string | undefined;
|
|
18
|
+
datapoints: {
|
|
19
|
+
timestamp: Date | undefined;
|
|
20
|
+
average: number | undefined;
|
|
21
|
+
sum: number | undefined;
|
|
22
|
+
minimum: number | undefined;
|
|
23
|
+
maximum: number | undefined;
|
|
24
|
+
sampleCount: number | undefined;
|
|
25
|
+
unit: import("@aws-sdk/client-cloudwatch").StandardUnit | undefined;
|
|
26
|
+
}[];
|
|
27
|
+
error?: undefined;
|
|
28
|
+
message?: undefined;
|
|
29
|
+
} | {
|
|
30
|
+
error: string;
|
|
31
|
+
message: string;
|
|
32
|
+
label?: undefined;
|
|
33
|
+
datapoints?: undefined;
|
|
34
|
+
}>;
|
|
35
|
+
//# sourceMappingURL=get-metric-data.d.ts.map
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { tool } from 'ai';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { GetMetricStatisticsCommand } from '@aws-sdk/client-cloudwatch';
|
|
4
|
+
import { createCloudWatchClient } from '../client.js';
|
|
5
|
+
export const awsGetCloudwatchMetricData = tool({
|
|
6
|
+
description: 'Retrieve CloudWatch metric statistics for a namespace and metric name (e.g. AWS/EC2 CPUUtilization). Use this to check resource health or usage trends.',
|
|
7
|
+
inputSchema: z.object({
|
|
8
|
+
awsCredentials: z.string().optional().describe('Injected by system; do not provide'),
|
|
9
|
+
region: z.string().optional().describe('AWS region to query (default: us-east-1)'),
|
|
10
|
+
namespace: z.string().describe('The metric namespace, e.g. "AWS/EC2"'),
|
|
11
|
+
metricName: z.string().describe('The metric name, e.g. "CPUUtilization"'),
|
|
12
|
+
dimensions: z
|
|
13
|
+
.record(z.string(), z.string())
|
|
14
|
+
.optional()
|
|
15
|
+
.describe('Metric dimensions as key-value pairs, e.g. {"InstanceId": "i-0123456789abcdef0"}'),
|
|
16
|
+
startTime: z.string().optional().describe('Start time in ISO 8601 format (default: 1 hour ago)'),
|
|
17
|
+
endTime: z.string().optional().describe('End time in ISO 8601 format (default: now)'),
|
|
18
|
+
period: z.number().optional().describe('Period in seconds (default: 300)'),
|
|
19
|
+
statistic: z
|
|
20
|
+
.enum(['Average', 'Sum', 'Minimum', 'Maximum', 'SampleCount'])
|
|
21
|
+
.optional()
|
|
22
|
+
.describe('Statistic to retrieve (default: Average)'),
|
|
23
|
+
}),
|
|
24
|
+
execute: async ({ awsCredentials, region, namespace, metricName, dimensions, startTime, endTime, period, statistic }) => {
|
|
25
|
+
if (!awsCredentials) {
|
|
26
|
+
return { error: 'AWS credentials are required. Connect AWS first.' };
|
|
27
|
+
}
|
|
28
|
+
try {
|
|
29
|
+
const client = createCloudWatchClient(awsCredentials, region);
|
|
30
|
+
const response = await client.send(new GetMetricStatisticsCommand({
|
|
31
|
+
Namespace: namespace,
|
|
32
|
+
MetricName: metricName,
|
|
33
|
+
Dimensions: dimensions ? Object.entries(dimensions).map(([Name, Value]) => ({ Name, Value })) : undefined,
|
|
34
|
+
StartTime: startTime ? new Date(startTime) : new Date(Date.now() - 3600_000),
|
|
35
|
+
EndTime: endTime ? new Date(endTime) : new Date(),
|
|
36
|
+
Period: period ?? 300,
|
|
37
|
+
Statistics: [statistic ?? 'Average'],
|
|
38
|
+
}));
|
|
39
|
+
return {
|
|
40
|
+
label: response.Label,
|
|
41
|
+
datapoints: (response.Datapoints ?? [])
|
|
42
|
+
.sort((a, b) => (a.Timestamp?.getTime() ?? 0) - (b.Timestamp?.getTime() ?? 0))
|
|
43
|
+
.map((point) => ({
|
|
44
|
+
timestamp: point.Timestamp,
|
|
45
|
+
average: point.Average,
|
|
46
|
+
sum: point.Sum,
|
|
47
|
+
minimum: point.Minimum,
|
|
48
|
+
maximum: point.Maximum,
|
|
49
|
+
sampleCount: point.SampleCount,
|
|
50
|
+
unit: point.Unit,
|
|
51
|
+
})),
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
catch (err) {
|
|
55
|
+
return {
|
|
56
|
+
error: 'Failed to get CloudWatch metric data',
|
|
57
|
+
message: err instanceof Error ? err.message : 'Unknown error',
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
});
|
|
62
|
+
//# sourceMappingURL=get-metric-data.js.map
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export declare const awsListCloudwatchAlarms: import("ai").Tool<{
|
|
2
|
+
region?: string | undefined;
|
|
3
|
+
awsCredentials?: string | undefined;
|
|
4
|
+
alarmNamePrefix?: string | undefined;
|
|
5
|
+
stateValue?: "OK" | "ALARM" | "INSUFFICIENT_DATA" | undefined;
|
|
6
|
+
maxRecords?: number | undefined;
|
|
7
|
+
}, {
|
|
8
|
+
error: string;
|
|
9
|
+
alarms?: undefined;
|
|
10
|
+
message?: undefined;
|
|
11
|
+
} | {
|
|
12
|
+
alarms: {
|
|
13
|
+
alarmName: string | undefined;
|
|
14
|
+
alarmArn: string | undefined;
|
|
15
|
+
stateValue: import("@aws-sdk/client-cloudwatch").StateValue | undefined;
|
|
16
|
+
stateReason: string | undefined;
|
|
17
|
+
metricName: string | undefined;
|
|
18
|
+
namespace: string | undefined;
|
|
19
|
+
threshold: number | undefined;
|
|
20
|
+
comparisonOperator: import("@aws-sdk/client-cloudwatch").ComparisonOperator | undefined;
|
|
21
|
+
}[];
|
|
22
|
+
error?: undefined;
|
|
23
|
+
message?: undefined;
|
|
24
|
+
} | {
|
|
25
|
+
error: string;
|
|
26
|
+
message: string;
|
|
27
|
+
alarms?: undefined;
|
|
28
|
+
}>;
|
|
29
|
+
//# sourceMappingURL=list-alarms.d.ts.map
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { tool } from 'ai';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { DescribeAlarmsCommand } from '@aws-sdk/client-cloudwatch';
|
|
4
|
+
import { createCloudWatchClient } from '../client.js';
|
|
5
|
+
export const awsListCloudwatchAlarms = tool({
|
|
6
|
+
description: 'List CloudWatch alarms, optionally filtered by name prefix or state.',
|
|
7
|
+
inputSchema: z.object({
|
|
8
|
+
awsCredentials: z.string().optional().describe('Injected by system; do not provide'),
|
|
9
|
+
region: z.string().optional().describe('AWS region to query (default: us-east-1)'),
|
|
10
|
+
alarmNamePrefix: z.string().optional().describe('Only return alarms whose name starts with this prefix'),
|
|
11
|
+
stateValue: z.enum(['OK', 'ALARM', 'INSUFFICIENT_DATA']).optional().describe('Only return alarms in this state'),
|
|
12
|
+
maxRecords: z.number().min(1).max(100).optional().describe('Maximum number of alarms to return'),
|
|
13
|
+
}),
|
|
14
|
+
execute: async ({ awsCredentials, region, alarmNamePrefix, stateValue, maxRecords }) => {
|
|
15
|
+
if (!awsCredentials) {
|
|
16
|
+
return { error: 'AWS credentials are required. Connect AWS first.' };
|
|
17
|
+
}
|
|
18
|
+
try {
|
|
19
|
+
const client = createCloudWatchClient(awsCredentials, region);
|
|
20
|
+
const response = await client.send(new DescribeAlarmsCommand({
|
|
21
|
+
AlarmNamePrefix: alarmNamePrefix,
|
|
22
|
+
StateValue: stateValue,
|
|
23
|
+
MaxRecords: maxRecords,
|
|
24
|
+
}));
|
|
25
|
+
return {
|
|
26
|
+
alarms: (response.MetricAlarms ?? []).map((alarm) => ({
|
|
27
|
+
alarmName: alarm.AlarmName,
|
|
28
|
+
alarmArn: alarm.AlarmArn,
|
|
29
|
+
stateValue: alarm.StateValue,
|
|
30
|
+
stateReason: alarm.StateReason,
|
|
31
|
+
metricName: alarm.MetricName,
|
|
32
|
+
namespace: alarm.Namespace,
|
|
33
|
+
threshold: alarm.Threshold,
|
|
34
|
+
comparisonOperator: alarm.ComparisonOperator,
|
|
35
|
+
})),
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
catch (err) {
|
|
39
|
+
return {
|
|
40
|
+
error: 'Failed to list CloudWatch alarms',
|
|
41
|
+
message: err instanceof Error ? err.message : 'Unknown error',
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
});
|
|
46
|
+
//# sourceMappingURL=list-alarms.js.map
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export declare const awsListCloudwatchLogGroups: import("ai").Tool<{
|
|
2
|
+
limit?: number | undefined;
|
|
3
|
+
region?: string | undefined;
|
|
4
|
+
awsCredentials?: string | undefined;
|
|
5
|
+
logGroupNamePrefix?: string | undefined;
|
|
6
|
+
}, {
|
|
7
|
+
error: string;
|
|
8
|
+
logGroups?: undefined;
|
|
9
|
+
message?: undefined;
|
|
10
|
+
} | {
|
|
11
|
+
logGroups: {
|
|
12
|
+
logGroupName: string | undefined;
|
|
13
|
+
creationTime: number | undefined;
|
|
14
|
+
retentionInDays: number | undefined;
|
|
15
|
+
storedBytes: number | undefined;
|
|
16
|
+
arn: string | undefined;
|
|
17
|
+
}[];
|
|
18
|
+
error?: undefined;
|
|
19
|
+
message?: undefined;
|
|
20
|
+
} | {
|
|
21
|
+
error: string;
|
|
22
|
+
message: string;
|
|
23
|
+
logGroups?: undefined;
|
|
24
|
+
}>;
|
|
25
|
+
//# sourceMappingURL=list-log-groups.d.ts.map
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { tool } from 'ai';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { DescribeLogGroupsCommand } from '@aws-sdk/client-cloudwatch-logs';
|
|
4
|
+
import { createCloudWatchLogsClient } from '../client.js';
|
|
5
|
+
export const awsListCloudwatchLogGroups = tool({
|
|
6
|
+
description: 'List CloudWatch log groups, optionally filtered by name prefix.',
|
|
7
|
+
inputSchema: z.object({
|
|
8
|
+
awsCredentials: z.string().optional().describe('Injected by system; do not provide'),
|
|
9
|
+
region: z.string().optional().describe('AWS region to query (default: us-east-1)'),
|
|
10
|
+
logGroupNamePrefix: z.string().optional().describe('Only return log groups whose name starts with this prefix'),
|
|
11
|
+
limit: z.number().min(1).max(50).optional().describe('Maximum number of log groups to return'),
|
|
12
|
+
}),
|
|
13
|
+
execute: async ({ awsCredentials, region, logGroupNamePrefix, limit }) => {
|
|
14
|
+
if (!awsCredentials) {
|
|
15
|
+
return { error: 'AWS credentials are required. Connect AWS first.' };
|
|
16
|
+
}
|
|
17
|
+
try {
|
|
18
|
+
const client = createCloudWatchLogsClient(awsCredentials, region);
|
|
19
|
+
const response = await client.send(new DescribeLogGroupsCommand({ logGroupNamePrefix, limit }));
|
|
20
|
+
return {
|
|
21
|
+
logGroups: (response.logGroups ?? []).map((group) => ({
|
|
22
|
+
logGroupName: group.logGroupName,
|
|
23
|
+
creationTime: group.creationTime,
|
|
24
|
+
retentionInDays: group.retentionInDays,
|
|
25
|
+
storedBytes: group.storedBytes,
|
|
26
|
+
arn: group.arn,
|
|
27
|
+
})),
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
catch (err) {
|
|
31
|
+
return {
|
|
32
|
+
error: 'Failed to list CloudWatch log groups',
|
|
33
|
+
message: err instanceof Error ? err.message : 'Unknown error',
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
});
|
|
38
|
+
//# sourceMappingURL=list-log-groups.js.map
|