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,158 @@
|
||||
import type {
|
||||
AthenaBatchGetQueryExecutionParams,
|
||||
AthenaBatchGetQueryExecutionResponse,
|
||||
} from '@/tools/athena/types'
|
||||
import type { ToolConfig } from '@/tools/types'
|
||||
|
||||
export const batchGetQueryExecutionTool: ToolConfig<
|
||||
AthenaBatchGetQueryExecutionParams,
|
||||
AthenaBatchGetQueryExecutionResponse
|
||||
> = {
|
||||
id: 'athena_batch_get_query_execution',
|
||||
name: 'Athena Batch Get Query Executions',
|
||||
description: 'Get the status and details of up to 50 Athena query executions in one call',
|
||||
version: '1.0.0',
|
||||
|
||||
params: {
|
||||
awsRegion: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
description: 'AWS region (e.g., us-east-1)',
|
||||
},
|
||||
awsAccessKeyId: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
description: 'AWS access key ID',
|
||||
},
|
||||
awsSecretAccessKey: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
description: 'AWS secret access key',
|
||||
},
|
||||
queryExecutionIds: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Comma-separated query execution IDs to check (up to 50)',
|
||||
},
|
||||
},
|
||||
|
||||
request: {
|
||||
url: '/api/tools/athena/batch-get-query-execution',
|
||||
method: 'POST',
|
||||
headers: () => ({ 'Content-Type': 'application/json' }),
|
||||
body: (params) => {
|
||||
const ids = params.queryExecutionIds
|
||||
.split(',')
|
||||
.map((id) => id.trim())
|
||||
.filter(Boolean)
|
||||
return {
|
||||
region: params.awsRegion,
|
||||
accessKeyId: params.awsAccessKeyId,
|
||||
secretAccessKey: params.awsSecretAccessKey,
|
||||
queryExecutionIds: ids,
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
transformResponse: async (response: Response) => {
|
||||
const data = await response.json()
|
||||
if (!response.ok) {
|
||||
throw new Error(data.error || 'Failed to batch get Athena query executions')
|
||||
}
|
||||
return {
|
||||
success: true,
|
||||
output: {
|
||||
queryExecutions: data.output.queryExecutions ?? [],
|
||||
unprocessedQueryExecutionIds: data.output.unprocessedQueryExecutionIds ?? [],
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
outputs: {
|
||||
queryExecutions: {
|
||||
type: 'array',
|
||||
description: 'Details for each successfully retrieved query execution',
|
||||
items: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
queryExecutionId: { type: 'string', description: 'Query execution ID' },
|
||||
query: { type: 'string', description: 'SQL query string', optional: true },
|
||||
state: {
|
||||
type: 'string',
|
||||
description: 'Query state (QUEUED, RUNNING, SUCCEEDED, FAILED, CANCELLED)',
|
||||
optional: true,
|
||||
},
|
||||
stateChangeReason: {
|
||||
type: 'string',
|
||||
description: 'Reason for state change',
|
||||
optional: true,
|
||||
},
|
||||
statementType: {
|
||||
type: 'string',
|
||||
description: 'Statement type (DDL, DML, UTILITY)',
|
||||
optional: true,
|
||||
},
|
||||
database: { type: 'string', description: 'Database name', optional: true },
|
||||
catalog: { type: 'string', description: 'Data catalog name', optional: true },
|
||||
workGroup: { type: 'string', description: 'Workgroup name', optional: true },
|
||||
submissionDateTime: {
|
||||
type: 'number',
|
||||
description: 'Query submission time (Unix epoch ms)',
|
||||
optional: true,
|
||||
},
|
||||
completionDateTime: {
|
||||
type: 'number',
|
||||
description: 'Query completion time (Unix epoch ms)',
|
||||
optional: true,
|
||||
},
|
||||
dataScannedInBytes: {
|
||||
type: 'number',
|
||||
description: 'Amount of data scanned in bytes',
|
||||
optional: true,
|
||||
},
|
||||
engineExecutionTimeInMillis: {
|
||||
type: 'number',
|
||||
description: 'Engine execution time in milliseconds',
|
||||
optional: true,
|
||||
},
|
||||
queryPlanningTimeInMillis: {
|
||||
type: 'number',
|
||||
description: 'Query planning time in milliseconds',
|
||||
optional: true,
|
||||
},
|
||||
queryQueueTimeInMillis: {
|
||||
type: 'number',
|
||||
description: 'Time the query spent in queue in milliseconds',
|
||||
optional: true,
|
||||
},
|
||||
totalExecutionTimeInMillis: {
|
||||
type: 'number',
|
||||
description: 'Total execution time in milliseconds',
|
||||
optional: true,
|
||||
},
|
||||
outputLocation: {
|
||||
type: 'string',
|
||||
description: 'S3 location of query results',
|
||||
optional: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
unprocessedQueryExecutionIds: {
|
||||
type: 'array',
|
||||
description: 'Query execution IDs that could not be retrieved, with error details',
|
||||
items: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
queryExecutionId: { type: 'string', description: 'Query execution ID', optional: true },
|
||||
errorCode: { type: 'string', description: 'Error code', optional: true },
|
||||
errorMessage: { type: 'string', description: 'Error message', optional: true },
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
import type {
|
||||
AthenaCreateNamedQueryParams,
|
||||
AthenaCreateNamedQueryResponse,
|
||||
} from '@/tools/athena/types'
|
||||
import type { ToolConfig } from '@/tools/types'
|
||||
|
||||
export const createNamedQueryTool: ToolConfig<
|
||||
AthenaCreateNamedQueryParams,
|
||||
AthenaCreateNamedQueryResponse
|
||||
> = {
|
||||
id: 'athena_create_named_query',
|
||||
name: 'Athena Create Named Query',
|
||||
description: 'Create a saved/named query in AWS Athena',
|
||||
version: '1.0.0',
|
||||
|
||||
params: {
|
||||
awsRegion: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
description: 'AWS region (e.g., us-east-1)',
|
||||
},
|
||||
awsAccessKeyId: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
description: 'AWS access key ID',
|
||||
},
|
||||
awsSecretAccessKey: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
description: 'AWS secret access key',
|
||||
},
|
||||
name: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Name for the saved query',
|
||||
},
|
||||
database: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Database the query runs against',
|
||||
},
|
||||
queryString: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'SQL query string to save',
|
||||
},
|
||||
description: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Description of the named query',
|
||||
},
|
||||
workGroup: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Workgroup to create the named query in',
|
||||
},
|
||||
},
|
||||
|
||||
request: {
|
||||
url: '/api/tools/athena/create-named-query',
|
||||
method: 'POST',
|
||||
headers: () => ({ 'Content-Type': 'application/json' }),
|
||||
body: (params) => ({
|
||||
region: params.awsRegion,
|
||||
accessKeyId: params.awsAccessKeyId,
|
||||
secretAccessKey: params.awsSecretAccessKey,
|
||||
name: params.name,
|
||||
database: params.database,
|
||||
queryString: params.queryString,
|
||||
...(params.description && { description: params.description }),
|
||||
...(params.workGroup && { workGroup: params.workGroup }),
|
||||
}),
|
||||
},
|
||||
|
||||
transformResponse: async (response: Response) => {
|
||||
const data = await response.json()
|
||||
if (!response.ok) {
|
||||
throw new Error(data.error || 'Failed to create Athena named query')
|
||||
}
|
||||
return {
|
||||
success: true,
|
||||
output: {
|
||||
namedQueryId: data.output.namedQueryId,
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
outputs: {
|
||||
namedQueryId: {
|
||||
type: 'string',
|
||||
description: 'ID of the created named query',
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
import type {
|
||||
AthenaDeleteNamedQueryParams,
|
||||
AthenaDeleteNamedQueryResponse,
|
||||
} from '@/tools/athena/types'
|
||||
import type { ToolConfig } from '@/tools/types'
|
||||
|
||||
export const deleteNamedQueryTool: ToolConfig<
|
||||
AthenaDeleteNamedQueryParams,
|
||||
AthenaDeleteNamedQueryResponse
|
||||
> = {
|
||||
id: 'athena_delete_named_query',
|
||||
name: 'Athena Delete Named Query',
|
||||
description: 'Delete a saved/named query in AWS Athena',
|
||||
version: '1.0.0',
|
||||
|
||||
params: {
|
||||
awsRegion: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
description: 'AWS region (e.g., us-east-1)',
|
||||
},
|
||||
awsAccessKeyId: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
description: 'AWS access key ID',
|
||||
},
|
||||
awsSecretAccessKey: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
description: 'AWS secret access key',
|
||||
},
|
||||
namedQueryId: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Named query ID to delete',
|
||||
},
|
||||
},
|
||||
|
||||
request: {
|
||||
url: '/api/tools/athena/delete-named-query',
|
||||
method: 'POST',
|
||||
headers: () => ({ 'Content-Type': 'application/json' }),
|
||||
body: (params) => ({
|
||||
region: params.awsRegion,
|
||||
accessKeyId: params.awsAccessKeyId,
|
||||
secretAccessKey: params.awsSecretAccessKey,
|
||||
namedQueryId: params.namedQueryId,
|
||||
}),
|
||||
},
|
||||
|
||||
transformResponse: async (response: Response) => {
|
||||
const data = await response.json()
|
||||
if (!response.ok) {
|
||||
throw new Error(data.error || 'Failed to delete Athena named query')
|
||||
}
|
||||
return {
|
||||
success: true,
|
||||
output: {
|
||||
success: true,
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
outputs: {
|
||||
success: {
|
||||
type: 'boolean',
|
||||
description: 'Whether the named query was successfully deleted',
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
import type { AthenaGetNamedQueryParams, AthenaGetNamedQueryResponse } from '@/tools/athena/types'
|
||||
import type { ToolConfig } from '@/tools/types'
|
||||
|
||||
export const getNamedQueryTool: ToolConfig<AthenaGetNamedQueryParams, AthenaGetNamedQueryResponse> =
|
||||
{
|
||||
id: 'athena_get_named_query',
|
||||
name: 'Athena Get Named Query',
|
||||
description: 'Get details of a saved/named query in AWS Athena',
|
||||
version: '1.0.0',
|
||||
|
||||
params: {
|
||||
awsRegion: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
description: 'AWS region (e.g., us-east-1)',
|
||||
},
|
||||
awsAccessKeyId: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
description: 'AWS access key ID',
|
||||
},
|
||||
awsSecretAccessKey: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
description: 'AWS secret access key',
|
||||
},
|
||||
namedQueryId: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Named query ID to retrieve',
|
||||
},
|
||||
},
|
||||
|
||||
request: {
|
||||
url: '/api/tools/athena/get-named-query',
|
||||
method: 'POST',
|
||||
headers: () => ({ 'Content-Type': 'application/json' }),
|
||||
body: (params) => ({
|
||||
region: params.awsRegion,
|
||||
accessKeyId: params.awsAccessKeyId,
|
||||
secretAccessKey: params.awsSecretAccessKey,
|
||||
namedQueryId: params.namedQueryId,
|
||||
}),
|
||||
},
|
||||
|
||||
transformResponse: async (response: Response) => {
|
||||
const data = await response.json()
|
||||
if (!response.ok) {
|
||||
throw new Error(data.error || 'Failed to get Athena named query')
|
||||
}
|
||||
return {
|
||||
success: true,
|
||||
output: {
|
||||
namedQueryId: data.output.namedQueryId,
|
||||
name: data.output.name,
|
||||
description: data.output.description ?? null,
|
||||
database: data.output.database,
|
||||
queryString: data.output.queryString,
|
||||
workGroup: data.output.workGroup ?? null,
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
outputs: {
|
||||
namedQueryId: { type: 'string', description: 'Named query ID' },
|
||||
name: { type: 'string', description: 'Name of the saved query' },
|
||||
description: { type: 'string', description: 'Query description', optional: true },
|
||||
database: { type: 'string', description: 'Database the query runs against' },
|
||||
queryString: { type: 'string', description: 'SQL query string' },
|
||||
workGroup: { type: 'string', description: 'Workgroup name', optional: true },
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,144 @@
|
||||
import type {
|
||||
AthenaGetQueryExecutionParams,
|
||||
AthenaGetQueryExecutionResponse,
|
||||
} from '@/tools/athena/types'
|
||||
import type { ToolConfig } from '@/tools/types'
|
||||
|
||||
export const getQueryExecutionTool: ToolConfig<
|
||||
AthenaGetQueryExecutionParams,
|
||||
AthenaGetQueryExecutionResponse
|
||||
> = {
|
||||
id: 'athena_get_query_execution',
|
||||
name: 'Athena Get Query Execution',
|
||||
description: 'Get the status and details of an Athena query execution',
|
||||
version: '1.0.0',
|
||||
|
||||
params: {
|
||||
awsRegion: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
description: 'AWS region (e.g., us-east-1)',
|
||||
},
|
||||
awsAccessKeyId: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
description: 'AWS access key ID',
|
||||
},
|
||||
awsSecretAccessKey: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
description: 'AWS secret access key',
|
||||
},
|
||||
queryExecutionId: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Query execution ID to check',
|
||||
},
|
||||
},
|
||||
|
||||
request: {
|
||||
url: '/api/tools/athena/get-query-execution',
|
||||
method: 'POST',
|
||||
headers: () => ({ 'Content-Type': 'application/json' }),
|
||||
body: (params) => ({
|
||||
region: params.awsRegion,
|
||||
accessKeyId: params.awsAccessKeyId,
|
||||
secretAccessKey: params.awsSecretAccessKey,
|
||||
queryExecutionId: params.queryExecutionId,
|
||||
}),
|
||||
},
|
||||
|
||||
transformResponse: async (response: Response) => {
|
||||
const data = await response.json()
|
||||
if (!response.ok) {
|
||||
throw new Error(data.error || 'Failed to get Athena query execution')
|
||||
}
|
||||
return {
|
||||
success: true,
|
||||
output: {
|
||||
queryExecutionId: data.output.queryExecutionId,
|
||||
query: data.output.query,
|
||||
state: data.output.state,
|
||||
stateChangeReason: data.output.stateChangeReason ?? null,
|
||||
statementType: data.output.statementType ?? null,
|
||||
database: data.output.database ?? null,
|
||||
catalog: data.output.catalog ?? null,
|
||||
workGroup: data.output.workGroup ?? null,
|
||||
submissionDateTime: data.output.submissionDateTime ?? null,
|
||||
completionDateTime: data.output.completionDateTime ?? null,
|
||||
dataScannedInBytes: data.output.dataScannedInBytes ?? null,
|
||||
engineExecutionTimeInMillis: data.output.engineExecutionTimeInMillis ?? null,
|
||||
queryPlanningTimeInMillis: data.output.queryPlanningTimeInMillis ?? null,
|
||||
queryQueueTimeInMillis: data.output.queryQueueTimeInMillis ?? null,
|
||||
totalExecutionTimeInMillis: data.output.totalExecutionTimeInMillis ?? null,
|
||||
outputLocation: data.output.outputLocation ?? null,
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
outputs: {
|
||||
queryExecutionId: { type: 'string', description: 'Query execution ID' },
|
||||
query: { type: 'string', description: 'SQL query string' },
|
||||
state: {
|
||||
type: 'string',
|
||||
description: 'Query state (QUEUED, RUNNING, SUCCEEDED, FAILED, CANCELLED)',
|
||||
},
|
||||
stateChangeReason: {
|
||||
type: 'string',
|
||||
description: 'Reason for state change (e.g., error message)',
|
||||
optional: true,
|
||||
},
|
||||
statementType: {
|
||||
type: 'string',
|
||||
description: 'Statement type (DDL, DML, UTILITY)',
|
||||
optional: true,
|
||||
},
|
||||
database: { type: 'string', description: 'Database name', optional: true },
|
||||
catalog: { type: 'string', description: 'Data catalog name', optional: true },
|
||||
workGroup: { type: 'string', description: 'Workgroup name', optional: true },
|
||||
submissionDateTime: {
|
||||
type: 'number',
|
||||
description: 'Query submission time (Unix epoch ms)',
|
||||
optional: true,
|
||||
},
|
||||
completionDateTime: {
|
||||
type: 'number',
|
||||
description: 'Query completion time (Unix epoch ms)',
|
||||
optional: true,
|
||||
},
|
||||
dataScannedInBytes: {
|
||||
type: 'number',
|
||||
description: 'Amount of data scanned in bytes',
|
||||
optional: true,
|
||||
},
|
||||
engineExecutionTimeInMillis: {
|
||||
type: 'number',
|
||||
description: 'Engine execution time in milliseconds',
|
||||
optional: true,
|
||||
},
|
||||
queryPlanningTimeInMillis: {
|
||||
type: 'number',
|
||||
description: 'Query planning time in milliseconds',
|
||||
optional: true,
|
||||
},
|
||||
queryQueueTimeInMillis: {
|
||||
type: 'number',
|
||||
description: 'Time the query spent in queue in milliseconds',
|
||||
optional: true,
|
||||
},
|
||||
totalExecutionTimeInMillis: {
|
||||
type: 'number',
|
||||
description: 'Total execution time in milliseconds',
|
||||
optional: true,
|
||||
},
|
||||
outputLocation: {
|
||||
type: 'string',
|
||||
description: 'S3 location of query results',
|
||||
optional: true,
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,105 @@
|
||||
import type {
|
||||
AthenaGetQueryResultsParams,
|
||||
AthenaGetQueryResultsResponse,
|
||||
} from '@/tools/athena/types'
|
||||
import type { ToolConfig } from '@/tools/types'
|
||||
|
||||
export const getQueryResultsTool: ToolConfig<
|
||||
AthenaGetQueryResultsParams,
|
||||
AthenaGetQueryResultsResponse
|
||||
> = {
|
||||
id: 'athena_get_query_results',
|
||||
name: 'Athena Get Query Results',
|
||||
description: 'Retrieve the results of a completed Athena query execution',
|
||||
version: '1.0.0',
|
||||
|
||||
params: {
|
||||
awsRegion: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
description: 'AWS region (e.g., us-east-1)',
|
||||
},
|
||||
awsAccessKeyId: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
description: 'AWS access key ID',
|
||||
},
|
||||
awsSecretAccessKey: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
description: 'AWS secret access key',
|
||||
},
|
||||
queryExecutionId: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Query execution ID to get results for',
|
||||
},
|
||||
maxResults: {
|
||||
type: 'number',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Maximum number of rows to return (1-999)',
|
||||
},
|
||||
nextToken: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Pagination token from a previous request',
|
||||
},
|
||||
},
|
||||
|
||||
request: {
|
||||
url: '/api/tools/athena/get-query-results',
|
||||
method: 'POST',
|
||||
headers: () => ({ 'Content-Type': 'application/json' }),
|
||||
body: (params) => ({
|
||||
region: params.awsRegion,
|
||||
accessKeyId: params.awsAccessKeyId,
|
||||
secretAccessKey: params.awsSecretAccessKey,
|
||||
queryExecutionId: params.queryExecutionId,
|
||||
...(params.maxResults !== undefined && { maxResults: params.maxResults }),
|
||||
...(params.nextToken && { nextToken: params.nextToken }),
|
||||
}),
|
||||
},
|
||||
|
||||
transformResponse: async (response: Response) => {
|
||||
const data = await response.json()
|
||||
if (!response.ok) {
|
||||
throw new Error(data.error || 'Failed to get Athena query results')
|
||||
}
|
||||
return {
|
||||
success: true,
|
||||
output: {
|
||||
columns: data.output.columns ?? [],
|
||||
rows: data.output.rows ?? [],
|
||||
nextToken: data.output.nextToken ?? null,
|
||||
updateCount: data.output.updateCount ?? null,
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
outputs: {
|
||||
columns: {
|
||||
type: 'array',
|
||||
description: 'Column metadata (name and type)',
|
||||
},
|
||||
rows: {
|
||||
type: 'array',
|
||||
description: 'Result rows as key-value objects',
|
||||
},
|
||||
nextToken: {
|
||||
type: 'string',
|
||||
description: 'Pagination token for next page of results',
|
||||
optional: true,
|
||||
},
|
||||
updateCount: {
|
||||
type: 'number',
|
||||
description: 'Number of rows affected (for INSERT/UPDATE statements)',
|
||||
optional: true,
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
import { batchGetQueryExecutionTool } from '@/tools/athena/batch_get_query_execution'
|
||||
import { createNamedQueryTool } from '@/tools/athena/create_named_query'
|
||||
import { deleteNamedQueryTool } from '@/tools/athena/delete_named_query'
|
||||
import { getNamedQueryTool } from '@/tools/athena/get_named_query'
|
||||
import { getQueryExecutionTool } from '@/tools/athena/get_query_execution'
|
||||
import { getQueryResultsTool } from '@/tools/athena/get_query_results'
|
||||
import { listDatabasesTool } from '@/tools/athena/list_databases'
|
||||
import { listNamedQueriesTool } from '@/tools/athena/list_named_queries'
|
||||
import { listQueryExecutionsTool } from '@/tools/athena/list_query_executions'
|
||||
import { listTableMetadataTool } from '@/tools/athena/list_table_metadata'
|
||||
import { startQueryTool } from '@/tools/athena/start_query'
|
||||
import { stopQueryTool } from '@/tools/athena/stop_query'
|
||||
|
||||
export const athenaBatchGetQueryExecutionTool = batchGetQueryExecutionTool
|
||||
export const athenaCreateNamedQueryTool = createNamedQueryTool
|
||||
export const athenaDeleteNamedQueryTool = deleteNamedQueryTool
|
||||
export const athenaGetNamedQueryTool = getNamedQueryTool
|
||||
export const athenaGetQueryExecutionTool = getQueryExecutionTool
|
||||
export const athenaGetQueryResultsTool = getQueryResultsTool
|
||||
export const athenaListDatabasesTool = listDatabasesTool
|
||||
export const athenaListNamedQueriesTool = listNamedQueriesTool
|
||||
export const athenaListQueryExecutionsTool = listQueryExecutionsTool
|
||||
export const athenaListTableMetadataTool = listTableMetadataTool
|
||||
export const athenaStartQueryTool = startQueryTool
|
||||
export const athenaStopQueryTool = stopQueryTool
|
||||
|
||||
export * from '@/tools/athena/types'
|
||||
@@ -0,0 +1,104 @@
|
||||
import type { AthenaListDatabasesParams, AthenaListDatabasesResponse } from '@/tools/athena/types'
|
||||
import type { ToolConfig } from '@/tools/types'
|
||||
|
||||
export const listDatabasesTool: ToolConfig<AthenaListDatabasesParams, AthenaListDatabasesResponse> =
|
||||
{
|
||||
id: 'athena_list_databases',
|
||||
name: 'Athena List Databases',
|
||||
description: 'List the databases available in an Athena data catalog',
|
||||
version: '1.0.0',
|
||||
|
||||
params: {
|
||||
awsRegion: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
description: 'AWS region (e.g., us-east-1)',
|
||||
},
|
||||
awsAccessKeyId: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
description: 'AWS access key ID',
|
||||
},
|
||||
awsSecretAccessKey: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
description: 'AWS secret access key',
|
||||
},
|
||||
catalogName: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Data catalog name to list databases from (e.g., AwsDataCatalog)',
|
||||
},
|
||||
workGroup: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description:
|
||||
'Workgroup for which the metadata is being fetched (required for IAM Identity Center enabled catalogs)',
|
||||
},
|
||||
maxResults: {
|
||||
type: 'number',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Maximum number of results (1-50)',
|
||||
},
|
||||
nextToken: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Pagination token from a previous request',
|
||||
},
|
||||
},
|
||||
|
||||
request: {
|
||||
url: '/api/tools/athena/list-databases',
|
||||
method: 'POST',
|
||||
headers: () => ({ 'Content-Type': 'application/json' }),
|
||||
body: (params) => ({
|
||||
region: params.awsRegion,
|
||||
accessKeyId: params.awsAccessKeyId,
|
||||
secretAccessKey: params.awsSecretAccessKey,
|
||||
catalogName: params.catalogName,
|
||||
...(params.workGroup && { workGroup: params.workGroup }),
|
||||
...(params.maxResults !== undefined && { maxResults: params.maxResults }),
|
||||
...(params.nextToken && { nextToken: params.nextToken }),
|
||||
}),
|
||||
},
|
||||
|
||||
transformResponse: async (response: Response) => {
|
||||
const data = await response.json()
|
||||
if (!response.ok) {
|
||||
throw new Error(data.error || 'Failed to list Athena databases')
|
||||
}
|
||||
return {
|
||||
success: true,
|
||||
output: {
|
||||
databases: data.output.databases ?? [],
|
||||
nextToken: data.output.nextToken ?? null,
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
outputs: {
|
||||
databases: {
|
||||
type: 'array',
|
||||
description: 'List of databases (name, description)',
|
||||
items: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
name: { type: 'string', description: 'Database name' },
|
||||
description: { type: 'string', description: 'Database description', optional: true },
|
||||
},
|
||||
},
|
||||
},
|
||||
nextToken: {
|
||||
type: 'string',
|
||||
description: 'Pagination token for next page',
|
||||
optional: true,
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
import type {
|
||||
AthenaListNamedQueriesParams,
|
||||
AthenaListNamedQueriesResponse,
|
||||
} from '@/tools/athena/types'
|
||||
import type { ToolConfig } from '@/tools/types'
|
||||
|
||||
export const listNamedQueriesTool: ToolConfig<
|
||||
AthenaListNamedQueriesParams,
|
||||
AthenaListNamedQueriesResponse
|
||||
> = {
|
||||
id: 'athena_list_named_queries',
|
||||
name: 'Athena List Named Queries',
|
||||
description: 'List saved/named query IDs in AWS Athena',
|
||||
version: '1.0.0',
|
||||
|
||||
params: {
|
||||
awsRegion: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
description: 'AWS region (e.g., us-east-1)',
|
||||
},
|
||||
awsAccessKeyId: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
description: 'AWS access key ID',
|
||||
},
|
||||
awsSecretAccessKey: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
description: 'AWS secret access key',
|
||||
},
|
||||
workGroup: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Workgroup to list named queries for',
|
||||
},
|
||||
maxResults: {
|
||||
type: 'number',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Maximum number of results (0-50)',
|
||||
},
|
||||
nextToken: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Pagination token from a previous request',
|
||||
},
|
||||
},
|
||||
|
||||
request: {
|
||||
url: '/api/tools/athena/list-named-queries',
|
||||
method: 'POST',
|
||||
headers: () => ({ 'Content-Type': 'application/json' }),
|
||||
body: (params) => ({
|
||||
region: params.awsRegion,
|
||||
accessKeyId: params.awsAccessKeyId,
|
||||
secretAccessKey: params.awsSecretAccessKey,
|
||||
...(params.workGroup && { workGroup: params.workGroup }),
|
||||
...(params.maxResults !== undefined && { maxResults: params.maxResults }),
|
||||
...(params.nextToken && { nextToken: params.nextToken }),
|
||||
}),
|
||||
},
|
||||
|
||||
transformResponse: async (response: Response) => {
|
||||
const data = await response.json()
|
||||
if (!response.ok) {
|
||||
throw new Error(data.error || 'Failed to list Athena named queries')
|
||||
}
|
||||
return {
|
||||
success: true,
|
||||
output: {
|
||||
namedQueryIds: data.output.namedQueryIds ?? [],
|
||||
nextToken: data.output.nextToken ?? null,
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
outputs: {
|
||||
namedQueryIds: {
|
||||
type: 'array',
|
||||
description: 'List of named query IDs',
|
||||
},
|
||||
nextToken: {
|
||||
type: 'string',
|
||||
description: 'Pagination token for next page',
|
||||
optional: true,
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
import type {
|
||||
AthenaListQueryExecutionsParams,
|
||||
AthenaListQueryExecutionsResponse,
|
||||
} from '@/tools/athena/types'
|
||||
import type { ToolConfig } from '@/tools/types'
|
||||
|
||||
export const listQueryExecutionsTool: ToolConfig<
|
||||
AthenaListQueryExecutionsParams,
|
||||
AthenaListQueryExecutionsResponse
|
||||
> = {
|
||||
id: 'athena_list_query_executions',
|
||||
name: 'Athena List Query Executions',
|
||||
description: 'List recent Athena query execution IDs',
|
||||
version: '1.0.0',
|
||||
|
||||
params: {
|
||||
awsRegion: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
description: 'AWS region (e.g., us-east-1)',
|
||||
},
|
||||
awsAccessKeyId: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
description: 'AWS access key ID',
|
||||
},
|
||||
awsSecretAccessKey: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
description: 'AWS secret access key',
|
||||
},
|
||||
workGroup: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Workgroup to list executions for (default: primary)',
|
||||
},
|
||||
maxResults: {
|
||||
type: 'number',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Maximum number of results (0-50)',
|
||||
},
|
||||
nextToken: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Pagination token from a previous request',
|
||||
},
|
||||
},
|
||||
|
||||
request: {
|
||||
url: '/api/tools/athena/list-query-executions',
|
||||
method: 'POST',
|
||||
headers: () => ({ 'Content-Type': 'application/json' }),
|
||||
body: (params) => ({
|
||||
region: params.awsRegion,
|
||||
accessKeyId: params.awsAccessKeyId,
|
||||
secretAccessKey: params.awsSecretAccessKey,
|
||||
...(params.workGroup && { workGroup: params.workGroup }),
|
||||
...(params.maxResults !== undefined && { maxResults: params.maxResults }),
|
||||
...(params.nextToken && { nextToken: params.nextToken }),
|
||||
}),
|
||||
},
|
||||
|
||||
transformResponse: async (response: Response) => {
|
||||
const data = await response.json()
|
||||
if (!response.ok) {
|
||||
throw new Error(data.error || 'Failed to list Athena query executions')
|
||||
}
|
||||
return {
|
||||
success: true,
|
||||
output: {
|
||||
queryExecutionIds: data.output.queryExecutionIds ?? [],
|
||||
nextToken: data.output.nextToken ?? null,
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
outputs: {
|
||||
queryExecutionIds: {
|
||||
type: 'array',
|
||||
description: 'List of query execution IDs',
|
||||
},
|
||||
nextToken: {
|
||||
type: 'string',
|
||||
description: 'Pagination token for next page',
|
||||
optional: true,
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,157 @@
|
||||
import type {
|
||||
AthenaListTableMetadataParams,
|
||||
AthenaListTableMetadataResponse,
|
||||
} from '@/tools/athena/types'
|
||||
import type { ToolConfig } from '@/tools/types'
|
||||
|
||||
export const listTableMetadataTool: ToolConfig<
|
||||
AthenaListTableMetadataParams,
|
||||
AthenaListTableMetadataResponse
|
||||
> = {
|
||||
id: 'athena_list_table_metadata',
|
||||
name: 'Athena List Table Metadata',
|
||||
description: 'List tables and their column/partition metadata for an Athena database',
|
||||
version: '1.0.0',
|
||||
|
||||
params: {
|
||||
awsRegion: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
description: 'AWS region (e.g., us-east-1)',
|
||||
},
|
||||
awsAccessKeyId: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
description: 'AWS access key ID',
|
||||
},
|
||||
awsSecretAccessKey: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
description: 'AWS secret access key',
|
||||
},
|
||||
catalogName: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Data catalog name (e.g., AwsDataCatalog)',
|
||||
},
|
||||
databaseName: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Database name to list tables from',
|
||||
},
|
||||
expression: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Regex filter that pattern-matches table names',
|
||||
},
|
||||
workGroup: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description:
|
||||
'Workgroup for which the metadata is being fetched (required for IAM Identity Center enabled catalogs)',
|
||||
},
|
||||
maxResults: {
|
||||
type: 'number',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Maximum number of results (1-50)',
|
||||
},
|
||||
nextToken: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Pagination token from a previous request',
|
||||
},
|
||||
},
|
||||
|
||||
request: {
|
||||
url: '/api/tools/athena/list-table-metadata',
|
||||
method: 'POST',
|
||||
headers: () => ({ 'Content-Type': 'application/json' }),
|
||||
body: (params) => ({
|
||||
region: params.awsRegion,
|
||||
accessKeyId: params.awsAccessKeyId,
|
||||
secretAccessKey: params.awsSecretAccessKey,
|
||||
catalogName: params.catalogName,
|
||||
databaseName: params.databaseName,
|
||||
...(params.expression && { expression: params.expression }),
|
||||
...(params.workGroup && { workGroup: params.workGroup }),
|
||||
...(params.maxResults !== undefined && { maxResults: params.maxResults }),
|
||||
...(params.nextToken && { nextToken: params.nextToken }),
|
||||
}),
|
||||
},
|
||||
|
||||
transformResponse: async (response: Response) => {
|
||||
const data = await response.json()
|
||||
if (!response.ok) {
|
||||
throw new Error(data.error || 'Failed to list Athena table metadata')
|
||||
}
|
||||
return {
|
||||
success: true,
|
||||
output: {
|
||||
tables: data.output.tables ?? [],
|
||||
nextToken: data.output.nextToken ?? null,
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
outputs: {
|
||||
tables: {
|
||||
type: 'array',
|
||||
description: 'Table metadata (name, type, columns, partition keys)',
|
||||
items: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
name: { type: 'string', description: 'Table name' },
|
||||
tableType: { type: 'string', description: 'Table type', optional: true },
|
||||
createTime: {
|
||||
type: 'number',
|
||||
description: 'Table creation time (Unix epoch ms)',
|
||||
optional: true,
|
||||
},
|
||||
lastAccessTime: {
|
||||
type: 'number',
|
||||
description: 'Table last access time (Unix epoch ms)',
|
||||
optional: true,
|
||||
},
|
||||
columns: {
|
||||
type: 'array',
|
||||
description: 'Column definitions',
|
||||
items: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
name: { type: 'string', description: 'Column name' },
|
||||
type: { type: 'string', description: 'Column data type', optional: true },
|
||||
comment: { type: 'string', description: 'Column comment', optional: true },
|
||||
},
|
||||
},
|
||||
},
|
||||
partitionKeys: {
|
||||
type: 'array',
|
||||
description: 'Partition key definitions',
|
||||
items: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
name: { type: 'string', description: 'Partition key name' },
|
||||
type: { type: 'string', description: 'Partition key data type', optional: true },
|
||||
comment: { type: 'string', description: 'Partition key comment', optional: true },
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
nextToken: {
|
||||
type: 'string',
|
||||
description: 'Pagination token for next page',
|
||||
optional: true,
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,96 @@
|
||||
import type { AthenaStartQueryParams, AthenaStartQueryResponse } from '@/tools/athena/types'
|
||||
import type { ToolConfig } from '@/tools/types'
|
||||
|
||||
export const startQueryTool: ToolConfig<AthenaStartQueryParams, AthenaStartQueryResponse> = {
|
||||
id: 'athena_start_query',
|
||||
name: 'Athena Start Query',
|
||||
description: 'Start an SQL query execution in AWS Athena',
|
||||
version: '1.0.0',
|
||||
|
||||
params: {
|
||||
awsRegion: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
description: 'AWS region (e.g., us-east-1)',
|
||||
},
|
||||
awsAccessKeyId: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
description: 'AWS access key ID',
|
||||
},
|
||||
awsSecretAccessKey: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
description: 'AWS secret access key',
|
||||
},
|
||||
queryString: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'SQL query string to execute',
|
||||
},
|
||||
database: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Database name within the catalog',
|
||||
},
|
||||
catalog: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Data catalog name (default: AwsDataCatalog)',
|
||||
},
|
||||
outputLocation: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'S3 output location for query results (e.g., s3://bucket/path/)',
|
||||
},
|
||||
workGroup: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Workgroup to execute the query in (default: primary)',
|
||||
},
|
||||
},
|
||||
|
||||
request: {
|
||||
url: '/api/tools/athena/start-query',
|
||||
method: 'POST',
|
||||
headers: () => ({ 'Content-Type': 'application/json' }),
|
||||
body: (params) => ({
|
||||
region: params.awsRegion,
|
||||
accessKeyId: params.awsAccessKeyId,
|
||||
secretAccessKey: params.awsSecretAccessKey,
|
||||
queryString: params.queryString,
|
||||
...(params.database && { database: params.database }),
|
||||
...(params.catalog && { catalog: params.catalog }),
|
||||
...(params.outputLocation && { outputLocation: params.outputLocation }),
|
||||
...(params.workGroup && { workGroup: params.workGroup }),
|
||||
}),
|
||||
},
|
||||
|
||||
transformResponse: async (response: Response) => {
|
||||
const data = await response.json()
|
||||
if (!response.ok) {
|
||||
throw new Error(data.error || 'Failed to start Athena query')
|
||||
}
|
||||
return {
|
||||
success: true,
|
||||
output: {
|
||||
queryExecutionId: data.output.queryExecutionId,
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
outputs: {
|
||||
queryExecutionId: {
|
||||
type: 'string',
|
||||
description: 'Unique ID of the started query execution',
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
import type { AthenaStopQueryParams, AthenaStopQueryResponse } from '@/tools/athena/types'
|
||||
import type { ToolConfig } from '@/tools/types'
|
||||
|
||||
export const stopQueryTool: ToolConfig<AthenaStopQueryParams, AthenaStopQueryResponse> = {
|
||||
id: 'athena_stop_query',
|
||||
name: 'Athena Stop Query',
|
||||
description: 'Stop a running Athena query execution',
|
||||
version: '1.0.0',
|
||||
|
||||
params: {
|
||||
awsRegion: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
description: 'AWS region (e.g., us-east-1)',
|
||||
},
|
||||
awsAccessKeyId: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
description: 'AWS access key ID',
|
||||
},
|
||||
awsSecretAccessKey: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
description: 'AWS secret access key',
|
||||
},
|
||||
queryExecutionId: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Query execution ID to stop',
|
||||
},
|
||||
},
|
||||
|
||||
request: {
|
||||
url: '/api/tools/athena/stop-query',
|
||||
method: 'POST',
|
||||
headers: () => ({ 'Content-Type': 'application/json' }),
|
||||
body: (params) => ({
|
||||
region: params.awsRegion,
|
||||
accessKeyId: params.awsAccessKeyId,
|
||||
secretAccessKey: params.awsSecretAccessKey,
|
||||
queryExecutionId: params.queryExecutionId,
|
||||
}),
|
||||
},
|
||||
|
||||
transformResponse: async (response: Response) => {
|
||||
const data = await response.json()
|
||||
if (!response.ok) {
|
||||
throw new Error(data.error || 'Failed to stop Athena query')
|
||||
}
|
||||
return {
|
||||
success: true,
|
||||
output: {
|
||||
success: true,
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
outputs: {
|
||||
success: {
|
||||
type: 'boolean',
|
||||
description: 'Whether the query was successfully stopped',
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,222 @@
|
||||
import type { ToolResponse } from '@/tools/types'
|
||||
|
||||
interface AthenaConnectionConfig {
|
||||
awsRegion: string
|
||||
awsAccessKeyId: string
|
||||
awsSecretAccessKey: string
|
||||
}
|
||||
|
||||
export interface AthenaStartQueryParams extends AthenaConnectionConfig {
|
||||
queryString: string
|
||||
database?: string
|
||||
catalog?: string
|
||||
outputLocation?: string
|
||||
workGroup?: string
|
||||
}
|
||||
|
||||
export interface AthenaStartQueryResponse extends ToolResponse {
|
||||
output: {
|
||||
queryExecutionId: string
|
||||
}
|
||||
}
|
||||
|
||||
export interface AthenaGetQueryExecutionParams extends AthenaConnectionConfig {
|
||||
queryExecutionId: string
|
||||
}
|
||||
|
||||
export interface AthenaGetQueryExecutionResponse extends ToolResponse {
|
||||
output: {
|
||||
queryExecutionId: string
|
||||
query: string
|
||||
state: string
|
||||
stateChangeReason: string | null
|
||||
statementType: string | null
|
||||
database: string | null
|
||||
catalog: string | null
|
||||
workGroup: string | null
|
||||
submissionDateTime: number | null
|
||||
completionDateTime: number | null
|
||||
dataScannedInBytes: number | null
|
||||
engineExecutionTimeInMillis: number | null
|
||||
queryPlanningTimeInMillis: number | null
|
||||
queryQueueTimeInMillis: number | null
|
||||
totalExecutionTimeInMillis: number | null
|
||||
outputLocation: string | null
|
||||
}
|
||||
}
|
||||
|
||||
export interface AthenaGetQueryResultsParams extends AthenaConnectionConfig {
|
||||
queryExecutionId: string
|
||||
maxResults?: number
|
||||
nextToken?: string
|
||||
}
|
||||
|
||||
export interface AthenaGetQueryResultsResponse extends ToolResponse {
|
||||
output: {
|
||||
columns: { name: string; type: string }[]
|
||||
rows: Record<string, string>[]
|
||||
nextToken: string | null
|
||||
updateCount: number | null
|
||||
}
|
||||
}
|
||||
|
||||
export interface AthenaStopQueryParams extends AthenaConnectionConfig {
|
||||
queryExecutionId: string
|
||||
}
|
||||
|
||||
export interface AthenaStopQueryResponse extends ToolResponse {
|
||||
output: {
|
||||
success: boolean
|
||||
}
|
||||
}
|
||||
|
||||
export interface AthenaListQueryExecutionsParams extends AthenaConnectionConfig {
|
||||
workGroup?: string
|
||||
maxResults?: number
|
||||
nextToken?: string
|
||||
}
|
||||
|
||||
export interface AthenaListQueryExecutionsResponse extends ToolResponse {
|
||||
output: {
|
||||
queryExecutionIds: string[]
|
||||
nextToken: string | null
|
||||
}
|
||||
}
|
||||
|
||||
export interface AthenaCreateNamedQueryParams extends AthenaConnectionConfig {
|
||||
name: string
|
||||
database: string
|
||||
queryString: string
|
||||
description?: string
|
||||
workGroup?: string
|
||||
}
|
||||
|
||||
export interface AthenaCreateNamedQueryResponse extends ToolResponse {
|
||||
output: {
|
||||
namedQueryId: string
|
||||
}
|
||||
}
|
||||
|
||||
export interface AthenaGetNamedQueryParams extends AthenaConnectionConfig {
|
||||
namedQueryId: string
|
||||
}
|
||||
|
||||
export interface AthenaGetNamedQueryResponse extends ToolResponse {
|
||||
output: {
|
||||
namedQueryId: string
|
||||
name: string
|
||||
description: string | null
|
||||
database: string
|
||||
queryString: string
|
||||
workGroup: string | null
|
||||
}
|
||||
}
|
||||
|
||||
export interface AthenaListNamedQueriesParams extends AthenaConnectionConfig {
|
||||
workGroup?: string
|
||||
maxResults?: number
|
||||
nextToken?: string
|
||||
}
|
||||
|
||||
export interface AthenaListNamedQueriesResponse extends ToolResponse {
|
||||
output: {
|
||||
namedQueryIds: string[]
|
||||
nextToken: string | null
|
||||
}
|
||||
}
|
||||
|
||||
export interface AthenaDeleteNamedQueryParams extends AthenaConnectionConfig {
|
||||
namedQueryId: string
|
||||
}
|
||||
|
||||
export interface AthenaDeleteNamedQueryResponse extends ToolResponse {
|
||||
output: {
|
||||
success: boolean
|
||||
}
|
||||
}
|
||||
|
||||
export interface AthenaBatchGetQueryExecutionParams extends AthenaConnectionConfig {
|
||||
queryExecutionIds: string
|
||||
}
|
||||
|
||||
export interface AthenaQueryExecutionSummary {
|
||||
queryExecutionId: string
|
||||
query: string | null
|
||||
state: string | null
|
||||
stateChangeReason: string | null
|
||||
statementType: string | null
|
||||
database: string | null
|
||||
catalog: string | null
|
||||
workGroup: string | null
|
||||
submissionDateTime: number | null
|
||||
completionDateTime: number | null
|
||||
dataScannedInBytes: number | null
|
||||
engineExecutionTimeInMillis: number | null
|
||||
queryPlanningTimeInMillis: number | null
|
||||
queryQueueTimeInMillis: number | null
|
||||
totalExecutionTimeInMillis: number | null
|
||||
outputLocation: string | null
|
||||
}
|
||||
|
||||
export interface AthenaUnprocessedQueryExecutionId {
|
||||
queryExecutionId: string | null
|
||||
errorCode: string | null
|
||||
errorMessage: string | null
|
||||
}
|
||||
|
||||
export interface AthenaBatchGetQueryExecutionResponse extends ToolResponse {
|
||||
output: {
|
||||
queryExecutions: AthenaQueryExecutionSummary[]
|
||||
unprocessedQueryExecutionIds: AthenaUnprocessedQueryExecutionId[]
|
||||
}
|
||||
}
|
||||
|
||||
export interface AthenaListDatabasesParams extends AthenaConnectionConfig {
|
||||
catalogName: string
|
||||
workGroup?: string
|
||||
maxResults?: number
|
||||
nextToken?: string
|
||||
}
|
||||
|
||||
export interface AthenaDatabase {
|
||||
name: string
|
||||
description: string | null
|
||||
}
|
||||
|
||||
export interface AthenaListDatabasesResponse extends ToolResponse {
|
||||
output: {
|
||||
databases: AthenaDatabase[]
|
||||
nextToken: string | null
|
||||
}
|
||||
}
|
||||
|
||||
export interface AthenaListTableMetadataParams extends AthenaConnectionConfig {
|
||||
catalogName: string
|
||||
databaseName: string
|
||||
expression?: string
|
||||
workGroup?: string
|
||||
maxResults?: number
|
||||
nextToken?: string
|
||||
}
|
||||
|
||||
export interface AthenaColumn {
|
||||
name: string
|
||||
type: string | null
|
||||
comment: string | null
|
||||
}
|
||||
|
||||
export interface AthenaTableMetadata {
|
||||
name: string
|
||||
tableType: string | null
|
||||
createTime: number | null
|
||||
lastAccessTime: number | null
|
||||
columns: AthenaColumn[]
|
||||
partitionKeys: AthenaColumn[]
|
||||
}
|
||||
|
||||
export interface AthenaListTableMetadataResponse extends ToolResponse {
|
||||
output: {
|
||||
tables: AthenaTableMetadata[]
|
||||
nextToken: string | null
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user