chore: import upstream snapshot with attribution
Publish CLI Package / publish-npm (push) Waiting to run
Publish Python SDK / publish-pypi (push) Waiting to run
Publish TypeScript SDK / publish-npm (push) Waiting to run
CI / Migrate Dev DB (push) Has been skipped
CI / Detect Version (push) Has been cancelled
CI / Migrate DB (push) Has been cancelled
CI / Build Dev ECR (./docker/app.Dockerfile, ECR_APP) (push) Has been cancelled
CI / Build Dev ECR (./docker/db.Dockerfile, ECR_MIGRATIONS) (push) Has been cancelled
CI / Build Dev ECR (./docker/pii.Dockerfile, ECR_PII) (push) Has been cancelled
CI / Build Dev ECR (./docker/realtime.Dockerfile, ECR_REALTIME) (push) Has been cancelled
CI / Deploy Trigger.dev (Dev) (push) Has been cancelled
CI / Build AMD64 (./docker/app.Dockerfile, ECR_APP, ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Build AMD64 (./docker/db.Dockerfile, ECR_MIGRATIONS, ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Build AMD64 (./docker/pii.Dockerfile, ECR_PII, ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Build AMD64 (./docker/realtime.Dockerfile, ECR_REALTIME, ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/app.Dockerfile, ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/db.Dockerfile, ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/pii.Dockerfile, ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/realtime.Dockerfile, ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Check Docs Changes (push) Has been cancelled
CI / Process Docs (push) Has been cancelled
CI / Create GitHub Release (push) Has been cancelled
CI / Test and Build (push) Has been cancelled
Publish CLI Package / publish-npm (push) Waiting to run
Publish Python SDK / publish-pypi (push) Waiting to run
Publish TypeScript SDK / publish-npm (push) Waiting to run
CI / Migrate Dev DB (push) Has been skipped
CI / Detect Version (push) Has been cancelled
CI / Migrate DB (push) Has been cancelled
CI / Build Dev ECR (./docker/app.Dockerfile, ECR_APP) (push) Has been cancelled
CI / Build Dev ECR (./docker/db.Dockerfile, ECR_MIGRATIONS) (push) Has been cancelled
CI / Build Dev ECR (./docker/pii.Dockerfile, ECR_PII) (push) Has been cancelled
CI / Build Dev ECR (./docker/realtime.Dockerfile, ECR_REALTIME) (push) Has been cancelled
CI / Deploy Trigger.dev (Dev) (push) Has been cancelled
CI / Build AMD64 (./docker/app.Dockerfile, ECR_APP, ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Build AMD64 (./docker/db.Dockerfile, ECR_MIGRATIONS, ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Build AMD64 (./docker/pii.Dockerfile, ECR_PII, ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Build AMD64 (./docker/realtime.Dockerfile, ECR_REALTIME, ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/app.Dockerfile, ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/db.Dockerfile, ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/pii.Dockerfile, ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/realtime.Dockerfile, ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Check Docs Changes (push) Has been cancelled
CI / Process Docs (push) Has been cancelled
CI / Create GitHub Release (push) Has been cancelled
CI / Test and Build (push) Has been cancelled
This commit is contained in:
@@ -0,0 +1,106 @@
|
||||
import type { DynamoDBDeleteParams, DynamoDBDeleteResponse } from '@/tools/dynamodb/types'
|
||||
import type { ToolConfig } from '@/tools/types'
|
||||
|
||||
export const deleteTool: ToolConfig<DynamoDBDeleteParams, DynamoDBDeleteResponse> = {
|
||||
id: 'dynamodb_delete',
|
||||
name: 'DynamoDB Delete',
|
||||
description: 'Delete an item from a DynamoDB table',
|
||||
version: '1.0.0',
|
||||
|
||||
params: {
|
||||
region: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
description: 'AWS region (e.g., us-east-1)',
|
||||
},
|
||||
accessKeyId: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
description: 'AWS access key ID',
|
||||
},
|
||||
secretAccessKey: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
description: 'AWS secret access key',
|
||||
},
|
||||
tableName: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'DynamoDB table name (e.g., "Users", "Orders")',
|
||||
},
|
||||
key: {
|
||||
type: 'json',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description:
|
||||
'Primary key of the item to delete (e.g., {"pk": "USER#123"} or {"pk": "ORDER#456", "sk": "ITEM#789"})',
|
||||
},
|
||||
conditionExpression: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description:
|
||||
'Condition that must be met for the delete to succeed (e.g., "attribute_exists(pk)")',
|
||||
},
|
||||
expressionAttributeNames: {
|
||||
type: 'json',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description:
|
||||
'Attribute name mappings for reserved words used in conditionExpression (e.g., {"#status": "status"})',
|
||||
},
|
||||
expressionAttributeValues: {
|
||||
type: 'json',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description:
|
||||
'Expression attribute values used in conditionExpression (e.g., {":status": "active"})',
|
||||
},
|
||||
},
|
||||
|
||||
request: {
|
||||
url: '/api/tools/dynamodb/delete',
|
||||
method: 'POST',
|
||||
headers: () => ({
|
||||
'Content-Type': 'application/json',
|
||||
}),
|
||||
body: (params) => ({
|
||||
region: params.region,
|
||||
accessKeyId: params.accessKeyId,
|
||||
secretAccessKey: params.secretAccessKey,
|
||||
tableName: params.tableName,
|
||||
key: params.key,
|
||||
...(params.conditionExpression && { conditionExpression: params.conditionExpression }),
|
||||
...(params.expressionAttributeNames && {
|
||||
expressionAttributeNames: params.expressionAttributeNames,
|
||||
}),
|
||||
...(params.expressionAttributeValues && {
|
||||
expressionAttributeValues: params.expressionAttributeValues,
|
||||
}),
|
||||
}),
|
||||
},
|
||||
|
||||
transformResponse: async (response: Response) => {
|
||||
const data = await response.json()
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error(data.error || 'DynamoDB delete failed')
|
||||
}
|
||||
|
||||
return {
|
||||
success: true,
|
||||
output: {
|
||||
message: data.message || 'Item deleted successfully',
|
||||
},
|
||||
error: undefined,
|
||||
}
|
||||
},
|
||||
|
||||
outputs: {
|
||||
message: { type: 'string', description: 'Operation status message' },
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
import type { DynamoDBGetParams, DynamoDBGetResponse } from '@/tools/dynamodb/types'
|
||||
import type { ToolConfig } from '@/tools/types'
|
||||
|
||||
export const getTool: ToolConfig<DynamoDBGetParams, DynamoDBGetResponse> = {
|
||||
id: 'dynamodb_get',
|
||||
name: 'DynamoDB Get',
|
||||
description: 'Get an item from a DynamoDB table by primary key',
|
||||
version: '1.0.0',
|
||||
|
||||
params: {
|
||||
region: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
description: 'AWS region (e.g., us-east-1)',
|
||||
},
|
||||
accessKeyId: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
description: 'AWS access key ID',
|
||||
},
|
||||
secretAccessKey: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
description: 'AWS secret access key',
|
||||
},
|
||||
tableName: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'DynamoDB table name (e.g., "Users", "Orders")',
|
||||
},
|
||||
key: {
|
||||
type: 'json',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description:
|
||||
'Primary key of the item to retrieve (e.g., {"pk": "USER#123"} or {"pk": "ORDER#456", "sk": "ITEM#789"})',
|
||||
},
|
||||
consistentRead: {
|
||||
type: 'boolean',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Use strongly consistent read',
|
||||
},
|
||||
},
|
||||
|
||||
request: {
|
||||
url: '/api/tools/dynamodb/get',
|
||||
method: 'POST',
|
||||
headers: () => ({
|
||||
'Content-Type': 'application/json',
|
||||
}),
|
||||
body: (params) => ({
|
||||
region: params.region,
|
||||
accessKeyId: params.accessKeyId,
|
||||
secretAccessKey: params.secretAccessKey,
|
||||
tableName: params.tableName,
|
||||
key: params.key,
|
||||
...(params.consistentRead !== undefined && { consistentRead: params.consistentRead }),
|
||||
}),
|
||||
},
|
||||
|
||||
transformResponse: async (response: Response) => {
|
||||
const data = await response.json()
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error(data.error || 'DynamoDB get failed')
|
||||
}
|
||||
|
||||
return {
|
||||
success: true,
|
||||
output: {
|
||||
message: data.message || 'Item retrieved successfully',
|
||||
item: data.item,
|
||||
},
|
||||
error: undefined,
|
||||
}
|
||||
},
|
||||
|
||||
outputs: {
|
||||
message: { type: 'string', description: 'Operation status message' },
|
||||
item: { type: 'json', description: 'Retrieved item', optional: true },
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
import { deleteTool } from '@/tools/dynamodb/delete'
|
||||
import { getTool } from '@/tools/dynamodb/get'
|
||||
import { introspectTool } from '@/tools/dynamodb/introspect'
|
||||
import { putTool } from '@/tools/dynamodb/put'
|
||||
import { queryTool } from '@/tools/dynamodb/query'
|
||||
import { scanTool } from '@/tools/dynamodb/scan'
|
||||
import { updateTool } from '@/tools/dynamodb/update'
|
||||
|
||||
export const dynamodbDeleteTool = deleteTool
|
||||
export const dynamodbGetTool = getTool
|
||||
export const dynamodbIntrospectTool = introspectTool
|
||||
export const dynamodbPutTool = putTool
|
||||
export const dynamodbQueryTool = queryTool
|
||||
export const dynamodbScanTool = scanTool
|
||||
export const dynamodbUpdateTool = updateTool
|
||||
|
||||
export * from './types'
|
||||
@@ -0,0 +1,80 @@
|
||||
import type { DynamoDBIntrospectParams, DynamoDBIntrospectResponse } from '@/tools/dynamodb/types'
|
||||
import type { ToolConfig } from '@/tools/types'
|
||||
|
||||
export const introspectTool: ToolConfig<DynamoDBIntrospectParams, DynamoDBIntrospectResponse> = {
|
||||
id: 'dynamodb_introspect',
|
||||
name: 'DynamoDB Introspect',
|
||||
description:
|
||||
'Introspect DynamoDB to list tables or get detailed schema information for a specific table',
|
||||
version: '1.0.0',
|
||||
|
||||
params: {
|
||||
region: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
description: 'AWS region (e.g., us-east-1)',
|
||||
},
|
||||
accessKeyId: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
description: 'AWS access key ID',
|
||||
},
|
||||
secretAccessKey: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
description: 'AWS secret access key',
|
||||
},
|
||||
tableName: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description:
|
||||
'Optional table name to get detailed schema (e.g., "Users", "Orders"). If not provided, lists all tables.',
|
||||
},
|
||||
},
|
||||
|
||||
request: {
|
||||
url: '/api/tools/dynamodb/introspect',
|
||||
method: 'POST',
|
||||
headers: () => ({
|
||||
'Content-Type': 'application/json',
|
||||
}),
|
||||
body: (params) => ({
|
||||
region: params.region,
|
||||
accessKeyId: params.accessKeyId,
|
||||
secretAccessKey: params.secretAccessKey,
|
||||
...(params.tableName && { tableName: params.tableName }),
|
||||
}),
|
||||
},
|
||||
|
||||
transformResponse: async (response: Response) => {
|
||||
const data = await response.json()
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error(data.error || 'DynamoDB introspection failed')
|
||||
}
|
||||
|
||||
return {
|
||||
success: true,
|
||||
output: {
|
||||
message: data.message || 'Introspection completed successfully',
|
||||
tables: data.tables || [],
|
||||
tableDetails: data.tableDetails,
|
||||
},
|
||||
error: undefined,
|
||||
}
|
||||
},
|
||||
|
||||
outputs: {
|
||||
message: { type: 'string', description: 'Operation status message' },
|
||||
tables: { type: 'array', description: 'List of table names in the region' },
|
||||
tableDetails: {
|
||||
type: 'json',
|
||||
description: 'Detailed schema information for a specific table',
|
||||
optional: true,
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,108 @@
|
||||
import type { DynamoDBPutParams, DynamoDBPutResponse } from '@/tools/dynamodb/types'
|
||||
import type { ToolConfig } from '@/tools/types'
|
||||
|
||||
export const putTool: ToolConfig<DynamoDBPutParams, DynamoDBPutResponse> = {
|
||||
id: 'dynamodb_put',
|
||||
name: 'DynamoDB Put',
|
||||
description: 'Put an item into a DynamoDB table',
|
||||
version: '1.0.0',
|
||||
|
||||
params: {
|
||||
region: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
description: 'AWS region (e.g., us-east-1)',
|
||||
},
|
||||
accessKeyId: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
description: 'AWS access key ID',
|
||||
},
|
||||
secretAccessKey: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
description: 'AWS secret access key',
|
||||
},
|
||||
tableName: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'DynamoDB table name (e.g., "Users", "Orders")',
|
||||
},
|
||||
item: {
|
||||
type: 'json',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description:
|
||||
'Item to put into the table (e.g., {"pk": "USER#123", "name": "John", "email": "john@example.com"})',
|
||||
},
|
||||
conditionExpression: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description:
|
||||
'Condition that must be met for the put to succeed (e.g., "attribute_not_exists(pk)" to prevent overwrites)',
|
||||
},
|
||||
expressionAttributeNames: {
|
||||
type: 'json',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description:
|
||||
'Attribute name mappings for reserved words used in conditionExpression (e.g., {"#name": "name"})',
|
||||
},
|
||||
expressionAttributeValues: {
|
||||
type: 'json',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description:
|
||||
'Expression attribute values used in conditionExpression (e.g., {":expected": "value"})',
|
||||
},
|
||||
},
|
||||
|
||||
request: {
|
||||
url: '/api/tools/dynamodb/put',
|
||||
method: 'POST',
|
||||
headers: () => ({
|
||||
'Content-Type': 'application/json',
|
||||
}),
|
||||
body: (params) => ({
|
||||
region: params.region,
|
||||
accessKeyId: params.accessKeyId,
|
||||
secretAccessKey: params.secretAccessKey,
|
||||
tableName: params.tableName,
|
||||
item: params.item,
|
||||
...(params.conditionExpression && { conditionExpression: params.conditionExpression }),
|
||||
...(params.expressionAttributeNames && {
|
||||
expressionAttributeNames: params.expressionAttributeNames,
|
||||
}),
|
||||
...(params.expressionAttributeValues && {
|
||||
expressionAttributeValues: params.expressionAttributeValues,
|
||||
}),
|
||||
}),
|
||||
},
|
||||
|
||||
transformResponse: async (response: Response) => {
|
||||
const data = await response.json()
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error(data.error || 'DynamoDB put failed')
|
||||
}
|
||||
|
||||
return {
|
||||
success: true,
|
||||
output: {
|
||||
message: data.message || 'Item created successfully',
|
||||
item: data.item,
|
||||
},
|
||||
error: undefined,
|
||||
}
|
||||
},
|
||||
|
||||
outputs: {
|
||||
message: { type: 'string', description: 'Operation status message' },
|
||||
item: { type: 'json', description: 'Created item', optional: true },
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,144 @@
|
||||
import type { DynamoDBQueryParams, DynamoDBQueryResponse } from '@/tools/dynamodb/types'
|
||||
import type { ToolConfig } from '@/tools/types'
|
||||
|
||||
export const queryTool: ToolConfig<DynamoDBQueryParams, DynamoDBQueryResponse> = {
|
||||
id: 'dynamodb_query',
|
||||
name: 'DynamoDB Query',
|
||||
description: 'Query items from a DynamoDB table using key conditions',
|
||||
version: '1.0.0',
|
||||
|
||||
params: {
|
||||
region: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
description: 'AWS region (e.g., us-east-1)',
|
||||
},
|
||||
accessKeyId: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
description: 'AWS access key ID',
|
||||
},
|
||||
secretAccessKey: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
description: 'AWS secret access key',
|
||||
},
|
||||
tableName: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'DynamoDB table name (e.g., "Users", "Orders")',
|
||||
},
|
||||
keyConditionExpression: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description:
|
||||
'Key condition expression (e.g., "pk = :pk" or "pk = :pk AND sk BEGINS_WITH :prefix")',
|
||||
},
|
||||
filterExpression: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Filter expression for results (e.g., "age > :minAge AND #status = :status")',
|
||||
},
|
||||
expressionAttributeNames: {
|
||||
type: 'json',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Attribute name mappings for reserved words (e.g., {"#status": "status"})',
|
||||
},
|
||||
expressionAttributeValues: {
|
||||
type: 'json',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Expression attribute values (e.g., {":pk": "USER#123", ":minAge": 18})',
|
||||
},
|
||||
indexName: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Secondary index name to query (e.g., "GSI1", "email-index")',
|
||||
},
|
||||
limit: {
|
||||
type: 'number',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Maximum number of items to return (e.g., 10, 50, 100)',
|
||||
},
|
||||
exclusiveStartKey: {
|
||||
type: 'json',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description:
|
||||
"Pagination token from a previous query's lastEvaluatedKey to continue fetching results",
|
||||
},
|
||||
scanIndexForward: {
|
||||
type: 'boolean',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description:
|
||||
'Sort order for the sort key: true for ascending (default), false for descending',
|
||||
},
|
||||
},
|
||||
|
||||
request: {
|
||||
url: '/api/tools/dynamodb/query',
|
||||
method: 'POST',
|
||||
headers: () => ({
|
||||
'Content-Type': 'application/json',
|
||||
}),
|
||||
body: (params) => ({
|
||||
region: params.region,
|
||||
accessKeyId: params.accessKeyId,
|
||||
secretAccessKey: params.secretAccessKey,
|
||||
tableName: params.tableName,
|
||||
keyConditionExpression: params.keyConditionExpression,
|
||||
...(params.filterExpression && { filterExpression: params.filterExpression }),
|
||||
...(params.expressionAttributeNames && {
|
||||
expressionAttributeNames: params.expressionAttributeNames,
|
||||
}),
|
||||
...(params.expressionAttributeValues && {
|
||||
expressionAttributeValues: params.expressionAttributeValues,
|
||||
}),
|
||||
...(params.indexName && { indexName: params.indexName }),
|
||||
...(params.limit && { limit: params.limit }),
|
||||
...(params.exclusiveStartKey && { exclusiveStartKey: params.exclusiveStartKey }),
|
||||
...(params.scanIndexForward !== undefined && { scanIndexForward: params.scanIndexForward }),
|
||||
}),
|
||||
},
|
||||
|
||||
transformResponse: async (response: Response) => {
|
||||
const data = await response.json()
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error(data.error || 'DynamoDB query failed')
|
||||
}
|
||||
|
||||
return {
|
||||
success: true,
|
||||
output: {
|
||||
message: data.message || 'Query executed successfully',
|
||||
items: data.items || [],
|
||||
count: data.count || 0,
|
||||
...(data.lastEvaluatedKey && { lastEvaluatedKey: data.lastEvaluatedKey }),
|
||||
},
|
||||
error: undefined,
|
||||
}
|
||||
},
|
||||
|
||||
outputs: {
|
||||
message: { type: 'string', description: 'Operation status message' },
|
||||
items: { type: 'array', description: 'Array of items returned' },
|
||||
count: { type: 'number', description: 'Number of items returned' },
|
||||
lastEvaluatedKey: {
|
||||
type: 'json',
|
||||
description:
|
||||
'Pagination token to pass as exclusiveStartKey to fetch the next page of results',
|
||||
optional: true,
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,129 @@
|
||||
import type { DynamoDBScanParams, DynamoDBScanResponse } from '@/tools/dynamodb/types'
|
||||
import type { ToolConfig } from '@/tools/types'
|
||||
|
||||
export const scanTool: ToolConfig<DynamoDBScanParams, DynamoDBScanResponse> = {
|
||||
id: 'dynamodb_scan',
|
||||
name: 'DynamoDB Scan',
|
||||
description: 'Scan all items in a DynamoDB table',
|
||||
version: '1.0.0',
|
||||
|
||||
params: {
|
||||
region: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
description: 'AWS region (e.g., us-east-1)',
|
||||
},
|
||||
accessKeyId: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
description: 'AWS access key ID',
|
||||
},
|
||||
secretAccessKey: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
description: 'AWS secret access key',
|
||||
},
|
||||
tableName: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'DynamoDB table name (e.g., "Users", "Orders")',
|
||||
},
|
||||
filterExpression: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Filter expression for results (e.g., "age > :minAge AND #status = :status")',
|
||||
},
|
||||
projectionExpression: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Attributes to retrieve (e.g., "pk, sk, #name, email")',
|
||||
},
|
||||
expressionAttributeNames: {
|
||||
type: 'json',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description:
|
||||
'Attribute name mappings for reserved words (e.g., {"#name": "name", "#status": "status"})',
|
||||
},
|
||||
expressionAttributeValues: {
|
||||
type: 'json',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Expression attribute values (e.g., {":minAge": 18, ":status": "active"})',
|
||||
},
|
||||
limit: {
|
||||
type: 'number',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Maximum number of items to return (e.g., 10, 50, 100)',
|
||||
},
|
||||
exclusiveStartKey: {
|
||||
type: 'json',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description:
|
||||
"Pagination token from a previous scan's lastEvaluatedKey to continue fetching results",
|
||||
},
|
||||
},
|
||||
|
||||
request: {
|
||||
url: '/api/tools/dynamodb/scan',
|
||||
method: 'POST',
|
||||
headers: () => ({
|
||||
'Content-Type': 'application/json',
|
||||
}),
|
||||
body: (params) => ({
|
||||
region: params.region,
|
||||
accessKeyId: params.accessKeyId,
|
||||
secretAccessKey: params.secretAccessKey,
|
||||
tableName: params.tableName,
|
||||
...(params.filterExpression && { filterExpression: params.filterExpression }),
|
||||
...(params.projectionExpression && { projectionExpression: params.projectionExpression }),
|
||||
...(params.expressionAttributeNames && {
|
||||
expressionAttributeNames: params.expressionAttributeNames,
|
||||
}),
|
||||
...(params.expressionAttributeValues && {
|
||||
expressionAttributeValues: params.expressionAttributeValues,
|
||||
}),
|
||||
...(params.limit && { limit: params.limit }),
|
||||
...(params.exclusiveStartKey && { exclusiveStartKey: params.exclusiveStartKey }),
|
||||
}),
|
||||
},
|
||||
|
||||
transformResponse: async (response: Response) => {
|
||||
const data = await response.json()
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error(data.error || 'DynamoDB scan failed')
|
||||
}
|
||||
|
||||
return {
|
||||
success: true,
|
||||
output: {
|
||||
message: data.message || 'Scan executed successfully',
|
||||
items: data.items || [],
|
||||
count: data.count || 0,
|
||||
...(data.lastEvaluatedKey && { lastEvaluatedKey: data.lastEvaluatedKey }),
|
||||
},
|
||||
error: undefined,
|
||||
}
|
||||
},
|
||||
|
||||
outputs: {
|
||||
message: { type: 'string', description: 'Operation status message' },
|
||||
items: { type: 'array', description: 'Array of items returned' },
|
||||
count: { type: 'number', description: 'Number of items returned' },
|
||||
lastEvaluatedKey: {
|
||||
type: 'json',
|
||||
description:
|
||||
'Pagination token to pass as exclusiveStartKey to fetch the next page of results',
|
||||
optional: true,
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,119 @@
|
||||
import type { ToolResponse } from '@/tools/types'
|
||||
|
||||
export interface DynamoDBConnectionConfig {
|
||||
region: string
|
||||
accessKeyId: string
|
||||
secretAccessKey: string
|
||||
}
|
||||
|
||||
export interface DynamoDBGetParams extends DynamoDBConnectionConfig {
|
||||
tableName: string
|
||||
key: Record<string, unknown>
|
||||
consistentRead?: boolean
|
||||
}
|
||||
|
||||
export interface DynamoDBPutParams extends DynamoDBConnectionConfig {
|
||||
tableName: string
|
||||
item: Record<string, unknown>
|
||||
conditionExpression?: string
|
||||
expressionAttributeNames?: Record<string, string>
|
||||
expressionAttributeValues?: Record<string, unknown>
|
||||
}
|
||||
|
||||
export interface DynamoDBQueryParams extends DynamoDBConnectionConfig {
|
||||
tableName: string
|
||||
keyConditionExpression: string
|
||||
filterExpression?: string
|
||||
expressionAttributeNames?: Record<string, string>
|
||||
expressionAttributeValues?: Record<string, unknown>
|
||||
indexName?: string
|
||||
limit?: number
|
||||
exclusiveStartKey?: Record<string, unknown>
|
||||
scanIndexForward?: boolean
|
||||
}
|
||||
|
||||
export interface DynamoDBScanParams extends DynamoDBConnectionConfig {
|
||||
tableName: string
|
||||
filterExpression?: string
|
||||
projectionExpression?: string
|
||||
expressionAttributeNames?: Record<string, string>
|
||||
expressionAttributeValues?: Record<string, unknown>
|
||||
limit?: number
|
||||
exclusiveStartKey?: Record<string, unknown>
|
||||
}
|
||||
|
||||
export interface DynamoDBUpdateParams extends DynamoDBConnectionConfig {
|
||||
tableName: string
|
||||
key: Record<string, unknown>
|
||||
updateExpression: string
|
||||
expressionAttributeNames?: Record<string, string>
|
||||
expressionAttributeValues?: Record<string, unknown>
|
||||
conditionExpression?: string
|
||||
}
|
||||
|
||||
export interface DynamoDBDeleteParams extends DynamoDBConnectionConfig {
|
||||
tableName: string
|
||||
key: Record<string, unknown>
|
||||
conditionExpression?: string
|
||||
expressionAttributeNames?: Record<string, string>
|
||||
expressionAttributeValues?: Record<string, unknown>
|
||||
}
|
||||
|
||||
interface DynamoDBBaseResponse extends ToolResponse {
|
||||
output: {
|
||||
message: string
|
||||
item?: Record<string, unknown>
|
||||
items?: Record<string, unknown>[]
|
||||
count?: number
|
||||
lastEvaluatedKey?: Record<string, unknown>
|
||||
}
|
||||
}
|
||||
|
||||
export type DynamoDBGetResponse = DynamoDBBaseResponse
|
||||
export type DynamoDBPutResponse = DynamoDBBaseResponse
|
||||
export type DynamoDBQueryResponse = DynamoDBBaseResponse
|
||||
export type DynamoDBScanResponse = DynamoDBBaseResponse
|
||||
export type DynamoDBUpdateResponse = DynamoDBBaseResponse
|
||||
export type DynamoDBDeleteResponse = DynamoDBBaseResponse
|
||||
export type DynamoDBResponse = DynamoDBBaseResponse
|
||||
|
||||
export interface DynamoDBIntrospectParams extends DynamoDBConnectionConfig {
|
||||
tableName?: string
|
||||
}
|
||||
|
||||
interface DynamoDBKeySchema {
|
||||
attributeName: string
|
||||
keyType: 'HASH' | 'RANGE'
|
||||
}
|
||||
|
||||
interface DynamoDBAttributeDefinition {
|
||||
attributeName: string
|
||||
attributeType: 'S' | 'N' | 'B'
|
||||
}
|
||||
|
||||
interface DynamoDBGSI {
|
||||
indexName: string
|
||||
keySchema: DynamoDBKeySchema[]
|
||||
projectionType: string
|
||||
indexStatus: string
|
||||
}
|
||||
|
||||
export interface DynamoDBTableSchema {
|
||||
tableName: string
|
||||
tableStatus: string
|
||||
keySchema: DynamoDBKeySchema[]
|
||||
attributeDefinitions: DynamoDBAttributeDefinition[]
|
||||
globalSecondaryIndexes: DynamoDBGSI[]
|
||||
localSecondaryIndexes: DynamoDBGSI[]
|
||||
itemCount: number
|
||||
tableSizeBytes: number
|
||||
billingMode: string
|
||||
}
|
||||
|
||||
export interface DynamoDBIntrospectResponse extends ToolResponse {
|
||||
output: {
|
||||
message: string
|
||||
tables: string[]
|
||||
tableDetails?: DynamoDBTableSchema
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,115 @@
|
||||
import type { DynamoDBUpdateParams, DynamoDBUpdateResponse } from '@/tools/dynamodb/types'
|
||||
import type { ToolConfig } from '@/tools/types'
|
||||
|
||||
export const updateTool: ToolConfig<DynamoDBUpdateParams, DynamoDBUpdateResponse> = {
|
||||
id: 'dynamodb_update',
|
||||
name: 'DynamoDB Update',
|
||||
description: 'Update an item in a DynamoDB table',
|
||||
version: '1.0.0',
|
||||
|
||||
params: {
|
||||
region: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
description: 'AWS region (e.g., us-east-1)',
|
||||
},
|
||||
accessKeyId: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
description: 'AWS access key ID',
|
||||
},
|
||||
secretAccessKey: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
description: 'AWS secret access key',
|
||||
},
|
||||
tableName: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'DynamoDB table name (e.g., "Users", "Orders")',
|
||||
},
|
||||
key: {
|
||||
type: 'json',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description:
|
||||
'Primary key of the item to update (e.g., {"pk": "USER#123"} or {"pk": "ORDER#456", "sk": "ITEM#789"})',
|
||||
},
|
||||
updateExpression: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description:
|
||||
'Update expression (e.g., "SET #name = :name, age = :age" or "SET #count = #count + :inc")',
|
||||
},
|
||||
expressionAttributeNames: {
|
||||
type: 'json',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description:
|
||||
'Attribute name mappings for reserved words (e.g., {"#name": "name", "#count": "count"})',
|
||||
},
|
||||
expressionAttributeValues: {
|
||||
type: 'json',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Expression attribute values (e.g., {":name": "John", ":age": 30, ":inc": 1})',
|
||||
},
|
||||
conditionExpression: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description:
|
||||
'Condition that must be met for the update to succeed (e.g., "attribute_exists(pk)" or "version = :expectedVersion")',
|
||||
},
|
||||
},
|
||||
|
||||
request: {
|
||||
url: '/api/tools/dynamodb/update',
|
||||
method: 'POST',
|
||||
headers: () => ({
|
||||
'Content-Type': 'application/json',
|
||||
}),
|
||||
body: (params) => ({
|
||||
region: params.region,
|
||||
accessKeyId: params.accessKeyId,
|
||||
secretAccessKey: params.secretAccessKey,
|
||||
tableName: params.tableName,
|
||||
key: params.key,
|
||||
updateExpression: params.updateExpression,
|
||||
...(params.expressionAttributeNames && {
|
||||
expressionAttributeNames: params.expressionAttributeNames,
|
||||
}),
|
||||
...(params.expressionAttributeValues && {
|
||||
expressionAttributeValues: params.expressionAttributeValues,
|
||||
}),
|
||||
...(params.conditionExpression && { conditionExpression: params.conditionExpression }),
|
||||
}),
|
||||
},
|
||||
|
||||
transformResponse: async (response: Response) => {
|
||||
const data = await response.json()
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error(data.error || 'DynamoDB update failed')
|
||||
}
|
||||
|
||||
return {
|
||||
success: true,
|
||||
output: {
|
||||
message: data.message || 'Item updated successfully',
|
||||
item: data.item,
|
||||
},
|
||||
error: undefined,
|
||||
}
|
||||
},
|
||||
|
||||
outputs: {
|
||||
message: { type: 'string', description: 'Operation status message' },
|
||||
item: { type: 'json', description: 'Updated item with all attributes', optional: true },
|
||||
},
|
||||
}
|
||||
Reference in New Issue
Block a user