-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Expand file tree
/
Copy pathfetch.ts
More file actions
89 lines (84 loc) · 2.83 KB
/
fetch.ts
File metadata and controls
89 lines (84 loc) · 2.83 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
import type { ToolConfig } from '../types'
interface AWSLambdaFetchParams {
accessKeyId: string
secretAccessKey: string
region: string
functionName: string
role: string
}
interface AWSLambdaFetchResponse {
functionArn: string
functionName: string
runtime: string
region: string
status: string
lastModified: string
codeSize: number
description: string
timeout: number
memorySize: number
environment: Record<string, string>
tags: Record<string, string>
codeFiles: Record<string, string>
handler: string
role: string
}
export const awsLambdaFetchTool: ToolConfig<AWSLambdaFetchParams, AWSLambdaFetchResponse> = {
id: 'aws_lambda_fetch',
name: 'AWS Lambda Fetch',
description:
'Fetch AWS Lambda function details, configuration, and code files. Use this to retrieve information about an existing Lambda function including its runtime, handler, timeout, memory settings, environment variables, tags, and actual code files. This is used to understand the current state of a function before making changes. The fetch operation is read-only and does not modify the function.',
version: '1.0.0',
params: {
// Common AWS parameters (always at the top)
accessKeyId: {
type: 'string',
required: true,
requiredForToolCall: true,
description: 'AWS Access Key ID for authentication. This is required to access AWS services.',
},
secretAccessKey: {
type: 'string',
required: true,
requiredForToolCall: true,
description:
'AWS Secret Access Key for authentication. This is required to access AWS services.',
},
region: {
type: 'string',
required: true,
requiredForToolCall: true,
description:
'AWS region where the Lambda function is located. Examples: us-east-1, eu-west-1, ap-southeast-2',
},
role: {
type: 'string',
required: true,
requiredForToolCall: true,
description:
'IAM Role ARN that the Lambda function will assume during execution. This role must have appropriate permissions for the function to operate correctly.',
},
// Operation-specific parameters
functionName: {
type: 'string',
required: true,
optionalToolInput: true,
description:
'Name of the existing Lambda function to fetch and understand. This must be the exact name of a function that already exists in the specified region. Use this to retrieve the current state before making changes.',
},
},
request: {
url: '/api/tools/aws-lambda/fetch',
method: 'POST',
headers: () => ({
'Content-Type': 'application/json',
}),
body: (params: AWSLambdaFetchParams) => ({
accessKeyId: params.accessKeyId,
secretAccessKey: params.secretAccessKey,
region: params.region,
functionName: params.functionName,
role: params.role,
}),
},
}