chore: import upstream snapshot with attribution
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) Has been cancelled
Publish Python SDK / publish-pypi (push) Has been cancelled
Publish TypeScript SDK / publish-npm (push) Has been cancelled
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) Has been cancelled
Publish Python SDK / publish-pypi (push) Has been cancelled
Publish TypeScript SDK / publish-npm (push) Has been cancelled
This commit is contained in:
@@ -0,0 +1,73 @@
|
||||
import type {
|
||||
DatabricksCancelRunParams,
|
||||
DatabricksCancelRunResponse,
|
||||
} from '@/tools/databricks/types'
|
||||
import type { ToolConfig } from '@/tools/types'
|
||||
|
||||
export const cancelRunTool: ToolConfig<DatabricksCancelRunParams, DatabricksCancelRunResponse> = {
|
||||
id: 'databricks_cancel_run',
|
||||
name: 'Databricks Cancel Run',
|
||||
description:
|
||||
'Cancel a running or pending Databricks job run. Cancellation is asynchronous; poll the run status to confirm termination.',
|
||||
version: '1.0.0',
|
||||
|
||||
params: {
|
||||
host: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
description: 'Databricks workspace host (e.g., dbc-abc123.cloud.databricks.com)',
|
||||
},
|
||||
apiKey: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
description: 'Databricks Personal Access Token',
|
||||
},
|
||||
runId: {
|
||||
type: 'number',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The canonical identifier of the run to cancel',
|
||||
},
|
||||
},
|
||||
|
||||
request: {
|
||||
url: (params) => {
|
||||
const host = params.host
|
||||
.trim()
|
||||
.replace(/^https?:\/\//, '')
|
||||
.replace(/\/$/, '')
|
||||
return `https://${host}/api/2.1/jobs/runs/cancel`
|
||||
},
|
||||
method: 'POST',
|
||||
headers: (params) => ({
|
||||
'Content-Type': 'application/json',
|
||||
Authorization: `Bearer ${params.apiKey}`,
|
||||
}),
|
||||
body: (params) => ({
|
||||
run_id: params.runId,
|
||||
}),
|
||||
},
|
||||
|
||||
transformResponse: async (response: Response) => {
|
||||
if (!response.ok) {
|
||||
const data = await response.json()
|
||||
throw new Error(data.message || data.error?.message || 'Failed to cancel run')
|
||||
}
|
||||
|
||||
return {
|
||||
success: true,
|
||||
output: {
|
||||
success: true,
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
outputs: {
|
||||
success: {
|
||||
type: 'boolean',
|
||||
description: 'Whether the cancel request was accepted',
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,178 @@
|
||||
import type {
|
||||
DatabricksExecuteSqlParams,
|
||||
DatabricksExecuteSqlResponse,
|
||||
} from '@/tools/databricks/types'
|
||||
import type { ToolConfig } from '@/tools/types'
|
||||
|
||||
export const executeSqlTool: ToolConfig<DatabricksExecuteSqlParams, DatabricksExecuteSqlResponse> =
|
||||
{
|
||||
id: 'databricks_execute_sql',
|
||||
name: 'Databricks Execute SQL',
|
||||
description:
|
||||
'Execute a SQL statement against a Databricks SQL warehouse and return results inline. Supports parameterized queries and Unity Catalog.',
|
||||
version: '1.0.0',
|
||||
|
||||
params: {
|
||||
host: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
description: 'Databricks workspace host (e.g., dbc-abc123.cloud.databricks.com)',
|
||||
},
|
||||
apiKey: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
description: 'Databricks Personal Access Token',
|
||||
},
|
||||
warehouseId: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The ID of the SQL warehouse to execute against',
|
||||
},
|
||||
statement: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The SQL statement to execute (max 16 MiB)',
|
||||
},
|
||||
catalog: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Unity Catalog name (equivalent to USE CATALOG)',
|
||||
},
|
||||
schema: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Schema name (equivalent to USE SCHEMA)',
|
||||
},
|
||||
rowLimit: {
|
||||
type: 'number',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Maximum number of rows to return',
|
||||
},
|
||||
waitTimeout: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description:
|
||||
'How long to wait for results (e.g., "50s"). Range: "0s" or "5s" to "50s". Default: "50s"',
|
||||
},
|
||||
},
|
||||
|
||||
request: {
|
||||
url: (params) => {
|
||||
const host = params.host
|
||||
.trim()
|
||||
.replace(/^https?:\/\//, '')
|
||||
.replace(/\/$/, '')
|
||||
return `https://${host}/api/2.0/sql/statements/`
|
||||
},
|
||||
method: 'POST',
|
||||
headers: (params) => ({
|
||||
'Content-Type': 'application/json',
|
||||
Authorization: `Bearer ${params.apiKey}`,
|
||||
}),
|
||||
body: (params) => {
|
||||
const body: Record<string, unknown> = {
|
||||
warehouse_id: params.warehouseId,
|
||||
statement: params.statement,
|
||||
format: 'JSON_ARRAY',
|
||||
disposition: 'INLINE',
|
||||
wait_timeout: params.waitTimeout || '50s',
|
||||
}
|
||||
if (params.catalog) body.catalog = params.catalog
|
||||
if (params.schema) body.schema = params.schema
|
||||
if (params.rowLimit) body.row_limit = params.rowLimit
|
||||
return body
|
||||
},
|
||||
},
|
||||
|
||||
transformResponse: async (response: Response) => {
|
||||
const data = await response.json()
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error(data.message || data.error?.message || 'Failed to execute SQL statement')
|
||||
}
|
||||
|
||||
const status = data.status?.state ?? 'UNKNOWN'
|
||||
if (status === 'FAILED') {
|
||||
throw new Error(
|
||||
data.status?.error?.message ||
|
||||
`SQL statement execution failed: ${data.status?.error?.error_code ?? 'UNKNOWN'}`
|
||||
)
|
||||
}
|
||||
|
||||
const columns =
|
||||
data.manifest?.schema?.columns?.map(
|
||||
(col: { name: string; position: number; type_name: string }) => ({
|
||||
name: col.name ?? '',
|
||||
position: col.position ?? 0,
|
||||
typeName: col.type_name ?? '',
|
||||
})
|
||||
) ?? null
|
||||
|
||||
return {
|
||||
success: true,
|
||||
output: {
|
||||
statementId: data.statement_id ?? '',
|
||||
status,
|
||||
columns,
|
||||
data: data.result?.data_array ?? null,
|
||||
totalRows: data.manifest?.total_row_count ?? null,
|
||||
truncated: data.manifest?.truncated ?? false,
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
outputs: {
|
||||
statementId: {
|
||||
type: 'string',
|
||||
description: 'Unique identifier for the executed statement',
|
||||
},
|
||||
status: {
|
||||
type: 'string',
|
||||
description: 'Execution status (SUCCEEDED, PENDING, RUNNING, FAILED, CANCELED, CLOSED)',
|
||||
},
|
||||
columns: {
|
||||
type: 'array',
|
||||
description: 'Column schema of the result set',
|
||||
optional: true,
|
||||
items: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
name: { type: 'string', description: 'Column name' },
|
||||
position: { type: 'number', description: 'Column position (0-based)' },
|
||||
typeName: {
|
||||
type: 'string',
|
||||
description:
|
||||
'Column type (STRING, INT, LONG, DOUBLE, BOOLEAN, TIMESTAMP, DATE, DECIMAL, etc.)',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
data: {
|
||||
type: 'array',
|
||||
description:
|
||||
'Result rows as a 2D array of strings where each inner array is a row of column values',
|
||||
optional: true,
|
||||
items: {
|
||||
type: 'array',
|
||||
description: 'A single row of column values as strings',
|
||||
},
|
||||
},
|
||||
totalRows: {
|
||||
type: 'number',
|
||||
description: 'Total number of rows in the result',
|
||||
optional: true,
|
||||
},
|
||||
truncated: {
|
||||
type: 'boolean',
|
||||
description: 'Whether the result set was truncated due to row_limit or byte_limit',
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,137 @@
|
||||
import type {
|
||||
DatabricksGetClusterParams,
|
||||
DatabricksGetClusterResponse,
|
||||
} from '@/tools/databricks/types'
|
||||
import type { ToolConfig } from '@/tools/types'
|
||||
|
||||
export const getClusterTool: ToolConfig<DatabricksGetClusterParams, DatabricksGetClusterResponse> =
|
||||
{
|
||||
id: 'databricks_get_cluster',
|
||||
name: 'Databricks Get Cluster',
|
||||
description:
|
||||
'Get the state, configuration, and resource details of a single Databricks cluster by its cluster ID.',
|
||||
version: '1.0.0',
|
||||
|
||||
params: {
|
||||
host: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
description: 'Databricks workspace host (e.g., dbc-abc123.cloud.databricks.com)',
|
||||
},
|
||||
apiKey: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
description: 'Databricks Personal Access Token',
|
||||
},
|
||||
clusterId: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The ID of the cluster to retrieve',
|
||||
},
|
||||
},
|
||||
|
||||
request: {
|
||||
url: (params) => {
|
||||
const host = params.host
|
||||
.trim()
|
||||
.replace(/^https?:\/\//, '')
|
||||
.replace(/\/$/, '')
|
||||
const url = new URL(`https://${host}/api/2.0/clusters/get`)
|
||||
url.searchParams.set('cluster_id', params.clusterId.trim())
|
||||
return url.toString()
|
||||
},
|
||||
method: 'GET',
|
||||
headers: (params) => ({
|
||||
Accept: 'application/json',
|
||||
Authorization: `Bearer ${params.apiKey}`,
|
||||
}),
|
||||
},
|
||||
|
||||
transformResponse: async (response: Response) => {
|
||||
const data = await response.json()
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error(data.message || data.error?.message || 'Failed to get cluster')
|
||||
}
|
||||
|
||||
return {
|
||||
success: true,
|
||||
output: {
|
||||
cluster: {
|
||||
clusterId: data.cluster_id ?? '',
|
||||
clusterName: data.cluster_name ?? '',
|
||||
state: data.state ?? 'UNKNOWN',
|
||||
stateMessage: data.state_message ?? '',
|
||||
creatorUserName: data.creator_user_name ?? '',
|
||||
sparkVersion: data.spark_version ?? '',
|
||||
nodeTypeId: data.node_type_id ?? '',
|
||||
driverNodeTypeId: data.driver_node_type_id ?? '',
|
||||
numWorkers: data.num_workers ?? null,
|
||||
autoscale: data.autoscale
|
||||
? {
|
||||
minWorkers: data.autoscale.min_workers ?? 0,
|
||||
maxWorkers: data.autoscale.max_workers ?? 0,
|
||||
}
|
||||
: null,
|
||||
clusterSource: data.cluster_source ?? '',
|
||||
autoterminationMinutes: data.autotermination_minutes ?? 0,
|
||||
startTime: data.start_time ?? null,
|
||||
},
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
outputs: {
|
||||
cluster: {
|
||||
type: 'object',
|
||||
description: 'Cluster detail',
|
||||
properties: {
|
||||
clusterId: { type: 'string', description: 'Unique cluster identifier' },
|
||||
clusterName: { type: 'string', description: 'Cluster display name' },
|
||||
state: {
|
||||
type: 'string',
|
||||
description:
|
||||
'Current state (PENDING, RUNNING, RESTARTING, RESIZING, TERMINATING, TERMINATED, ERROR, UNKNOWN)',
|
||||
},
|
||||
stateMessage: { type: 'string', description: 'Human-readable state description' },
|
||||
creatorUserName: { type: 'string', description: 'Email of the cluster creator' },
|
||||
sparkVersion: {
|
||||
type: 'string',
|
||||
description: 'Spark runtime version (e.g., 13.3.x-scala2.12)',
|
||||
},
|
||||
nodeTypeId: { type: 'string', description: 'Worker node type identifier' },
|
||||
driverNodeTypeId: { type: 'string', description: 'Driver node type identifier' },
|
||||
numWorkers: {
|
||||
type: 'number',
|
||||
description: 'Number of worker nodes (for fixed-size clusters)',
|
||||
optional: true,
|
||||
},
|
||||
autoscale: {
|
||||
type: 'object',
|
||||
description: 'Autoscaling configuration (null for fixed-size clusters)',
|
||||
optional: true,
|
||||
properties: {
|
||||
minWorkers: { type: 'number', description: 'Minimum number of workers' },
|
||||
maxWorkers: { type: 'number', description: 'Maximum number of workers' },
|
||||
},
|
||||
},
|
||||
clusterSource: {
|
||||
type: 'string',
|
||||
description: 'Origin (API, UI, JOB, MODELS, PIPELINE, PIPELINE_MAINTENANCE, SQL)',
|
||||
},
|
||||
autoterminationMinutes: {
|
||||
type: 'number',
|
||||
description: 'Minutes of inactivity before auto-termination (0 = disabled)',
|
||||
},
|
||||
startTime: {
|
||||
type: 'number',
|
||||
description: 'Cluster start timestamp (epoch ms)',
|
||||
optional: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,105 @@
|
||||
import type { DatabricksGetJobParams, DatabricksGetJobResponse } from '@/tools/databricks/types'
|
||||
import type { ToolConfig } from '@/tools/types'
|
||||
|
||||
export const getJobTool: ToolConfig<DatabricksGetJobParams, DatabricksGetJobResponse> = {
|
||||
id: 'databricks_get_job',
|
||||
name: 'Databricks Get Job',
|
||||
description: 'Get the full definition and settings of a single Databricks job by its job ID.',
|
||||
version: '1.0.0',
|
||||
|
||||
params: {
|
||||
host: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
description: 'Databricks workspace host (e.g., dbc-abc123.cloud.databricks.com)',
|
||||
},
|
||||
apiKey: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
description: 'Databricks Personal Access Token',
|
||||
},
|
||||
jobId: {
|
||||
type: 'number',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The canonical identifier of the job to retrieve',
|
||||
},
|
||||
},
|
||||
|
||||
request: {
|
||||
url: (params) => {
|
||||
const host = params.host
|
||||
.trim()
|
||||
.replace(/^https?:\/\//, '')
|
||||
.replace(/\/$/, '')
|
||||
const url = new URL(`https://${host}/api/2.1/jobs/get`)
|
||||
url.searchParams.set('job_id', String(params.jobId))
|
||||
return url.toString()
|
||||
},
|
||||
method: 'GET',
|
||||
headers: (params) => ({
|
||||
Accept: 'application/json',
|
||||
Authorization: `Bearer ${params.apiKey}`,
|
||||
}),
|
||||
},
|
||||
|
||||
transformResponse: async (response: Response) => {
|
||||
const data = await response.json()
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error(data.message || data.error?.message || 'Failed to get job')
|
||||
}
|
||||
|
||||
const settings = data.settings ?? {}
|
||||
|
||||
return {
|
||||
success: true,
|
||||
output: {
|
||||
jobId: data.job_id ?? 0,
|
||||
name: settings.name ?? '',
|
||||
creatorUserName: data.creator_user_name ?? '',
|
||||
runAsUserName: data.run_as_user_name ?? '',
|
||||
createdTime: data.created_time ?? 0,
|
||||
format: settings.format ?? '',
|
||||
maxConcurrentRuns: settings.max_concurrent_runs ?? 1,
|
||||
timeoutSeconds: settings.timeout_seconds ?? null,
|
||||
schedule: settings.schedule ?? null,
|
||||
tags: settings.tags ?? null,
|
||||
tasks: settings.tasks ?? [],
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
outputs: {
|
||||
jobId: { type: 'number', description: 'The job ID' },
|
||||
name: { type: 'string', description: 'Job name' },
|
||||
creatorUserName: { type: 'string', description: 'Email of the job creator' },
|
||||
runAsUserName: { type: 'string', description: 'User the job runs as' },
|
||||
createdTime: { type: 'number', description: 'Job creation timestamp (epoch ms)' },
|
||||
format: { type: 'string', description: 'Job format (SINGLE_TASK or MULTI_TASK)' },
|
||||
maxConcurrentRuns: { type: 'number', description: 'Maximum number of concurrent runs' },
|
||||
timeoutSeconds: {
|
||||
type: 'number',
|
||||
description: 'Job-level timeout in seconds (0 or null means no timeout)',
|
||||
optional: true,
|
||||
},
|
||||
schedule: {
|
||||
type: 'object',
|
||||
description:
|
||||
'Cron schedule configuration (quartz_cron_expression, timezone_id, pause_status)',
|
||||
optional: true,
|
||||
},
|
||||
tags: {
|
||||
type: 'object',
|
||||
description: 'Key-value tags applied to the job',
|
||||
optional: true,
|
||||
},
|
||||
tasks: {
|
||||
type: 'array',
|
||||
description: 'Task definitions for the job (empty for single-task jobs)',
|
||||
items: { type: 'object' },
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,180 @@
|
||||
import type { DatabricksGetRunParams, DatabricksGetRunResponse } from '@/tools/databricks/types'
|
||||
import type { ToolConfig } from '@/tools/types'
|
||||
|
||||
export const getRunTool: ToolConfig<DatabricksGetRunParams, DatabricksGetRunResponse> = {
|
||||
id: 'databricks_get_run',
|
||||
name: 'Databricks Get Run',
|
||||
description: 'Get the status, timing, and details of a Databricks job run by its run ID.',
|
||||
version: '1.0.0',
|
||||
|
||||
params: {
|
||||
host: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
description: 'Databricks workspace host (e.g., dbc-abc123.cloud.databricks.com)',
|
||||
},
|
||||
apiKey: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
description: 'Databricks Personal Access Token',
|
||||
},
|
||||
runId: {
|
||||
type: 'number',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The canonical identifier of the run',
|
||||
},
|
||||
includeHistory: {
|
||||
type: 'boolean',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Include repair history in the response',
|
||||
},
|
||||
includeResolvedValues: {
|
||||
type: 'boolean',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Include resolved parameter values in the response',
|
||||
},
|
||||
},
|
||||
|
||||
request: {
|
||||
url: (params) => {
|
||||
const host = params.host
|
||||
.trim()
|
||||
.replace(/^https?:\/\//, '')
|
||||
.replace(/\/$/, '')
|
||||
const url = new URL(`https://${host}/api/2.1/jobs/runs/get`)
|
||||
url.searchParams.set('run_id', String(params.runId))
|
||||
if (params.includeHistory) url.searchParams.set('include_history', 'true')
|
||||
if (params.includeResolvedValues) url.searchParams.set('include_resolved_values', 'true')
|
||||
return url.toString()
|
||||
},
|
||||
method: 'GET',
|
||||
headers: (params) => ({
|
||||
Accept: 'application/json',
|
||||
Authorization: `Bearer ${params.apiKey}`,
|
||||
}),
|
||||
},
|
||||
|
||||
transformResponse: async (response: Response) => {
|
||||
const data = await response.json()
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error(data.message || data.error?.message || 'Failed to get run details')
|
||||
}
|
||||
|
||||
return {
|
||||
success: true,
|
||||
output: {
|
||||
runId: data.run_id ?? 0,
|
||||
jobId: data.job_id ?? 0,
|
||||
runName: data.run_name ?? '',
|
||||
runType: data.run_type ?? '',
|
||||
attemptNumber: data.attempt_number ?? 0,
|
||||
state: {
|
||||
lifeCycleState: data.state?.life_cycle_state ?? 'UNKNOWN',
|
||||
resultState: data.state?.result_state ?? null,
|
||||
stateMessage: data.state?.state_message ?? '',
|
||||
userCancelledOrTimedout: data.state?.user_cancelled_or_timedout ?? false,
|
||||
},
|
||||
startTime: data.start_time ?? null,
|
||||
endTime: data.end_time ?? null,
|
||||
setupDuration: data.setup_duration ?? null,
|
||||
executionDuration: data.execution_duration ?? null,
|
||||
cleanupDuration: data.cleanup_duration ?? null,
|
||||
queueDuration: data.queue_duration ?? null,
|
||||
runPageUrl: data.run_page_url ?? '',
|
||||
creatorUserName: data.creator_user_name ?? '',
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
outputs: {
|
||||
runId: {
|
||||
type: 'number',
|
||||
description: 'The run ID',
|
||||
},
|
||||
jobId: {
|
||||
type: 'number',
|
||||
description: 'The job ID this run belongs to',
|
||||
},
|
||||
runName: {
|
||||
type: 'string',
|
||||
description: 'Name of the run',
|
||||
},
|
||||
runType: {
|
||||
type: 'string',
|
||||
description: 'Type of run (JOB_RUN, WORKFLOW_RUN, SUBMIT_RUN)',
|
||||
},
|
||||
attemptNumber: {
|
||||
type: 'number',
|
||||
description: 'Retry attempt number (0 for initial attempt)',
|
||||
},
|
||||
state: {
|
||||
type: 'object',
|
||||
description: 'Run state information',
|
||||
properties: {
|
||||
lifeCycleState: {
|
||||
type: 'string',
|
||||
description:
|
||||
'Lifecycle state (QUEUED, PENDING, RUNNING, TERMINATING, TERMINATED, SKIPPED, INTERNAL_ERROR, BLOCKED, WAITING_FOR_RETRY)',
|
||||
},
|
||||
resultState: {
|
||||
type: 'string',
|
||||
description:
|
||||
'Result state (SUCCESS, FAILED, TIMEDOUT, CANCELED, SUCCESS_WITH_FAILURES, UPSTREAM_FAILED, UPSTREAM_CANCELED, EXCLUDED)',
|
||||
optional: true,
|
||||
},
|
||||
stateMessage: {
|
||||
type: 'string',
|
||||
description: 'Descriptive message for the current state',
|
||||
},
|
||||
userCancelledOrTimedout: {
|
||||
type: 'boolean',
|
||||
description: 'Whether the run was cancelled by user or timed out',
|
||||
},
|
||||
},
|
||||
},
|
||||
startTime: {
|
||||
type: 'number',
|
||||
description: 'Run start timestamp (epoch ms)',
|
||||
optional: true,
|
||||
},
|
||||
endTime: {
|
||||
type: 'number',
|
||||
description: 'Run end timestamp (epoch ms, 0 if still running)',
|
||||
optional: true,
|
||||
},
|
||||
setupDuration: {
|
||||
type: 'number',
|
||||
description: 'Cluster setup duration (ms)',
|
||||
optional: true,
|
||||
},
|
||||
executionDuration: {
|
||||
type: 'number',
|
||||
description: 'Execution duration (ms)',
|
||||
optional: true,
|
||||
},
|
||||
cleanupDuration: {
|
||||
type: 'number',
|
||||
description: 'Cleanup duration (ms)',
|
||||
optional: true,
|
||||
},
|
||||
queueDuration: {
|
||||
type: 'number',
|
||||
description: 'Time spent in queue before execution (ms)',
|
||||
optional: true,
|
||||
},
|
||||
runPageUrl: {
|
||||
type: 'string',
|
||||
description: 'URL to the run detail page in Databricks UI',
|
||||
},
|
||||
creatorUserName: {
|
||||
type: 'string',
|
||||
description: 'Email of the user who triggered the run',
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,114 @@
|
||||
import type {
|
||||
DatabricksGetRunOutputParams,
|
||||
DatabricksGetRunOutputResponse,
|
||||
} from '@/tools/databricks/types'
|
||||
import type { ToolConfig } from '@/tools/types'
|
||||
|
||||
export const getRunOutputTool: ToolConfig<
|
||||
DatabricksGetRunOutputParams,
|
||||
DatabricksGetRunOutputResponse
|
||||
> = {
|
||||
id: 'databricks_get_run_output',
|
||||
name: 'Databricks Get Run Output',
|
||||
description:
|
||||
'Get the output of a completed Databricks job run, including notebook results, error messages, and logs. For multi-task jobs, use the task run ID (not the parent run ID).',
|
||||
version: '1.0.0',
|
||||
|
||||
params: {
|
||||
host: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
description: 'Databricks workspace host (e.g., dbc-abc123.cloud.databricks.com)',
|
||||
},
|
||||
apiKey: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
description: 'Databricks Personal Access Token',
|
||||
},
|
||||
runId: {
|
||||
type: 'number',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The run ID to get output for. For multi-task jobs, use the task run ID',
|
||||
},
|
||||
},
|
||||
|
||||
request: {
|
||||
url: (params) => {
|
||||
const host = params.host
|
||||
.trim()
|
||||
.replace(/^https?:\/\//, '')
|
||||
.replace(/\/$/, '')
|
||||
return `https://${host}/api/2.1/jobs/runs/get-output?run_id=${params.runId}`
|
||||
},
|
||||
method: 'GET',
|
||||
headers: (params) => ({
|
||||
Accept: 'application/json',
|
||||
Authorization: `Bearer ${params.apiKey}`,
|
||||
}),
|
||||
},
|
||||
|
||||
transformResponse: async (response: Response) => {
|
||||
const data = await response.json()
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error(data.message || data.error?.message || 'Failed to get run output')
|
||||
}
|
||||
|
||||
return {
|
||||
success: true,
|
||||
output: {
|
||||
notebookOutput: data.notebook_output
|
||||
? {
|
||||
result: data.notebook_output.result ?? null,
|
||||
truncated: data.notebook_output.truncated ?? false,
|
||||
}
|
||||
: null,
|
||||
error: data.error ?? null,
|
||||
errorTrace: data.error_trace ?? null,
|
||||
logs: data.logs ?? null,
|
||||
logsTruncated: data.logs_truncated ?? false,
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
outputs: {
|
||||
notebookOutput: {
|
||||
type: 'object',
|
||||
description: 'Notebook task output (from dbutils.notebook.exit())',
|
||||
optional: true,
|
||||
properties: {
|
||||
result: {
|
||||
type: 'string',
|
||||
description: 'Value passed to dbutils.notebook.exit() (max 5 MB)',
|
||||
optional: true,
|
||||
},
|
||||
truncated: {
|
||||
type: 'boolean',
|
||||
description: 'Whether the result was truncated',
|
||||
},
|
||||
},
|
||||
},
|
||||
error: {
|
||||
type: 'string',
|
||||
description: 'Error message if the run failed or output is unavailable',
|
||||
optional: true,
|
||||
},
|
||||
errorTrace: {
|
||||
type: 'string',
|
||||
description: 'Error stack trace if available',
|
||||
optional: true,
|
||||
},
|
||||
logs: {
|
||||
type: 'string',
|
||||
description: 'Log output (last 5 MB) from spark_jar, spark_python, or python_wheel tasks',
|
||||
optional: true,
|
||||
},
|
||||
logsTruncated: {
|
||||
type: 'boolean',
|
||||
description: 'Whether the log output was truncated',
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,136 @@
|
||||
import type {
|
||||
DatabricksExecuteSqlResponse,
|
||||
DatabricksGetStatementParams,
|
||||
} from '@/tools/databricks/types'
|
||||
import type { ToolConfig } from '@/tools/types'
|
||||
|
||||
export const getStatementTool: ToolConfig<
|
||||
DatabricksGetStatementParams,
|
||||
DatabricksExecuteSqlResponse
|
||||
> = {
|
||||
id: 'databricks_get_statement',
|
||||
name: 'Databricks Get Statement',
|
||||
description:
|
||||
'Poll a SQL statement by its ID to retrieve status and results. Use this after Execute SQL when a query runs longer than the wait timeout.',
|
||||
version: '1.0.0',
|
||||
|
||||
params: {
|
||||
host: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
description: 'Databricks workspace host (e.g., dbc-abc123.cloud.databricks.com)',
|
||||
},
|
||||
apiKey: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
description: 'Databricks Personal Access Token',
|
||||
},
|
||||
statementId: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The ID of the statement to fetch (returned by Execute SQL)',
|
||||
},
|
||||
},
|
||||
|
||||
request: {
|
||||
url: (params) => {
|
||||
const host = params.host
|
||||
.trim()
|
||||
.replace(/^https?:\/\//, '')
|
||||
.replace(/\/$/, '')
|
||||
return `https://${host}/api/2.0/sql/statements/${params.statementId.trim()}`
|
||||
},
|
||||
method: 'GET',
|
||||
headers: (params) => ({
|
||||
Accept: 'application/json',
|
||||
Authorization: `Bearer ${params.apiKey}`,
|
||||
}),
|
||||
},
|
||||
|
||||
transformResponse: async (response: Response) => {
|
||||
const data = await response.json()
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error(data.message || data.error?.message || 'Failed to get statement')
|
||||
}
|
||||
|
||||
const status = data.status?.state ?? 'UNKNOWN'
|
||||
if (status === 'FAILED') {
|
||||
throw new Error(
|
||||
data.status?.error?.message ||
|
||||
`SQL statement execution failed: ${data.status?.error?.error_code ?? 'UNKNOWN'}`
|
||||
)
|
||||
}
|
||||
|
||||
const columns =
|
||||
data.manifest?.schema?.columns?.map(
|
||||
(col: { name: string; position: number; type_name: string }) => ({
|
||||
name: col.name ?? '',
|
||||
position: col.position ?? 0,
|
||||
typeName: col.type_name ?? '',
|
||||
})
|
||||
) ?? null
|
||||
|
||||
return {
|
||||
success: true,
|
||||
output: {
|
||||
statementId: data.statement_id ?? '',
|
||||
status,
|
||||
columns,
|
||||
data: data.result?.data_array ?? null,
|
||||
totalRows: data.manifest?.total_row_count ?? null,
|
||||
truncated: data.manifest?.truncated ?? false,
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
outputs: {
|
||||
statementId: {
|
||||
type: 'string',
|
||||
description: 'Unique identifier for the statement',
|
||||
},
|
||||
status: {
|
||||
type: 'string',
|
||||
description: 'Execution status (SUCCEEDED, PENDING, RUNNING, FAILED, CANCELED, CLOSED)',
|
||||
},
|
||||
columns: {
|
||||
type: 'array',
|
||||
description: 'Column schema of the result set',
|
||||
optional: true,
|
||||
items: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
name: { type: 'string', description: 'Column name' },
|
||||
position: { type: 'number', description: 'Column position (0-based)' },
|
||||
typeName: {
|
||||
type: 'string',
|
||||
description:
|
||||
'Column type (STRING, INT, LONG, DOUBLE, BOOLEAN, TIMESTAMP, DATE, DECIMAL, etc.)',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
data: {
|
||||
type: 'array',
|
||||
description:
|
||||
'Result rows as a 2D array of strings where each inner array is a row of column values',
|
||||
optional: true,
|
||||
items: {
|
||||
type: 'array',
|
||||
description: 'A single row of column values as strings',
|
||||
},
|
||||
},
|
||||
totalRows: {
|
||||
type: 'number',
|
||||
description: 'Total number of rows in the result',
|
||||
optional: true,
|
||||
},
|
||||
truncated: {
|
||||
type: 'boolean',
|
||||
description: 'Whether the result set was truncated due to row_limit or byte_limit',
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
import { cancelRunTool } from '@/tools/databricks/cancel_run'
|
||||
import { executeSqlTool } from '@/tools/databricks/execute_sql'
|
||||
import { getClusterTool } from '@/tools/databricks/get_cluster'
|
||||
import { getJobTool } from '@/tools/databricks/get_job'
|
||||
import { getRunTool } from '@/tools/databricks/get_run'
|
||||
import { getRunOutputTool } from '@/tools/databricks/get_run_output'
|
||||
import { getStatementTool } from '@/tools/databricks/get_statement'
|
||||
import { listClustersTool } from '@/tools/databricks/list_clusters'
|
||||
import { listJobsTool } from '@/tools/databricks/list_jobs'
|
||||
import { listRunsTool } from '@/tools/databricks/list_runs'
|
||||
import { listWarehousesTool } from '@/tools/databricks/list_warehouses'
|
||||
import { runJobTool } from '@/tools/databricks/run_job'
|
||||
|
||||
export const databricksExecuteSqlTool = executeSqlTool
|
||||
export const databricksGetStatementTool = getStatementTool
|
||||
export const databricksListJobsTool = listJobsTool
|
||||
export const databricksGetJobTool = getJobTool
|
||||
export const databricksRunJobTool = runJobTool
|
||||
export const databricksGetRunTool = getRunTool
|
||||
export const databricksListRunsTool = listRunsTool
|
||||
export const databricksCancelRunTool = cancelRunTool
|
||||
export const databricksGetRunOutputTool = getRunOutputTool
|
||||
export const databricksListClustersTool = listClustersTool
|
||||
export const databricksGetClusterTool = getClusterTool
|
||||
export const databricksListWarehousesTool = listWarehousesTool
|
||||
@@ -0,0 +1,146 @@
|
||||
import type { DatabricksBaseParams, DatabricksListClustersResponse } from '@/tools/databricks/types'
|
||||
import type { ToolConfig } from '@/tools/types'
|
||||
|
||||
export const listClustersTool: ToolConfig<DatabricksBaseParams, DatabricksListClustersResponse> = {
|
||||
id: 'databricks_list_clusters',
|
||||
name: 'Databricks List Clusters',
|
||||
description:
|
||||
'List all clusters in a Databricks workspace including their state, configuration, and resource details.',
|
||||
version: '1.0.0',
|
||||
|
||||
params: {
|
||||
host: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
description: 'Databricks workspace host (e.g., dbc-abc123.cloud.databricks.com)',
|
||||
},
|
||||
apiKey: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
description: 'Databricks Personal Access Token',
|
||||
},
|
||||
},
|
||||
|
||||
request: {
|
||||
url: (params) => {
|
||||
const host = params.host
|
||||
.trim()
|
||||
.replace(/^https?:\/\//, '')
|
||||
.replace(/\/$/, '')
|
||||
return `https://${host}/api/2.0/clusters/list`
|
||||
},
|
||||
method: 'GET',
|
||||
headers: (params) => ({
|
||||
Accept: 'application/json',
|
||||
Authorization: `Bearer ${params.apiKey}`,
|
||||
}),
|
||||
},
|
||||
|
||||
transformResponse: async (response: Response) => {
|
||||
const data = await response.json()
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error(data.message || data.error?.message || 'Failed to list clusters')
|
||||
}
|
||||
|
||||
const clusters = (data.clusters ?? []).map(
|
||||
(cluster: {
|
||||
cluster_id?: string
|
||||
cluster_name?: string
|
||||
state?: string
|
||||
state_message?: string
|
||||
creator_user_name?: string
|
||||
spark_version?: string
|
||||
node_type_id?: string
|
||||
driver_node_type_id?: string
|
||||
num_workers?: number
|
||||
autoscale?: { min_workers?: number; max_workers?: number }
|
||||
cluster_source?: string
|
||||
autotermination_minutes?: number
|
||||
start_time?: number
|
||||
}) => ({
|
||||
clusterId: cluster.cluster_id ?? '',
|
||||
clusterName: cluster.cluster_name ?? '',
|
||||
state: cluster.state ?? 'UNKNOWN',
|
||||
stateMessage: cluster.state_message ?? '',
|
||||
creatorUserName: cluster.creator_user_name ?? '',
|
||||
sparkVersion: cluster.spark_version ?? '',
|
||||
nodeTypeId: cluster.node_type_id ?? '',
|
||||
driverNodeTypeId: cluster.driver_node_type_id ?? '',
|
||||
numWorkers: cluster.num_workers ?? null,
|
||||
autoscale: cluster.autoscale
|
||||
? {
|
||||
minWorkers: cluster.autoscale.min_workers ?? 0,
|
||||
maxWorkers: cluster.autoscale.max_workers ?? 0,
|
||||
}
|
||||
: null,
|
||||
clusterSource: cluster.cluster_source ?? '',
|
||||
autoterminationMinutes: cluster.autotermination_minutes ?? 0,
|
||||
startTime: cluster.start_time ?? null,
|
||||
})
|
||||
)
|
||||
|
||||
return {
|
||||
success: true,
|
||||
output: {
|
||||
clusters,
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
outputs: {
|
||||
clusters: {
|
||||
type: 'array',
|
||||
description: 'List of clusters in the workspace',
|
||||
items: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
clusterId: { type: 'string', description: 'Unique cluster identifier' },
|
||||
clusterName: { type: 'string', description: 'Cluster display name' },
|
||||
state: {
|
||||
type: 'string',
|
||||
description:
|
||||
'Current state (PENDING, RUNNING, RESTARTING, RESIZING, TERMINATING, TERMINATED, ERROR, UNKNOWN)',
|
||||
},
|
||||
stateMessage: { type: 'string', description: 'Human-readable state description' },
|
||||
creatorUserName: { type: 'string', description: 'Email of the cluster creator' },
|
||||
sparkVersion: {
|
||||
type: 'string',
|
||||
description: 'Spark runtime version (e.g., 13.3.x-scala2.12)',
|
||||
},
|
||||
nodeTypeId: { type: 'string', description: 'Worker node type identifier' },
|
||||
driverNodeTypeId: { type: 'string', description: 'Driver node type identifier' },
|
||||
numWorkers: {
|
||||
type: 'number',
|
||||
description: 'Number of worker nodes (for fixed-size clusters)',
|
||||
optional: true,
|
||||
},
|
||||
autoscale: {
|
||||
type: 'object',
|
||||
description: 'Autoscaling configuration (null for fixed-size clusters)',
|
||||
optional: true,
|
||||
properties: {
|
||||
minWorkers: { type: 'number', description: 'Minimum number of workers' },
|
||||
maxWorkers: { type: 'number', description: 'Maximum number of workers' },
|
||||
},
|
||||
},
|
||||
clusterSource: {
|
||||
type: 'string',
|
||||
description: 'Origin (API, UI, JOB, MODELS, PIPELINE, PIPELINE_MAINTENANCE, SQL)',
|
||||
},
|
||||
autoterminationMinutes: {
|
||||
type: 'number',
|
||||
description: 'Minutes of inactivity before auto-termination (0 = disabled)',
|
||||
},
|
||||
startTime: {
|
||||
type: 'number',
|
||||
description: 'Cluster start timestamp (epoch ms)',
|
||||
optional: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,128 @@
|
||||
import type { DatabricksListJobsParams, DatabricksListJobsResponse } from '@/tools/databricks/types'
|
||||
import type { ToolConfig } from '@/tools/types'
|
||||
|
||||
export const listJobsTool: ToolConfig<DatabricksListJobsParams, DatabricksListJobsResponse> = {
|
||||
id: 'databricks_list_jobs',
|
||||
name: 'Databricks List Jobs',
|
||||
description: 'List all jobs in a Databricks workspace with optional filtering by name.',
|
||||
version: '1.0.0',
|
||||
|
||||
params: {
|
||||
host: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
description: 'Databricks workspace host (e.g., dbc-abc123.cloud.databricks.com)',
|
||||
},
|
||||
apiKey: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
description: 'Databricks Personal Access Token',
|
||||
},
|
||||
limit: {
|
||||
type: 'number',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Maximum number of jobs to return (range 1-100, default 20)',
|
||||
},
|
||||
offset: {
|
||||
type: 'number',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Offset for pagination',
|
||||
},
|
||||
name: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Filter jobs by exact name (case-insensitive)',
|
||||
},
|
||||
expandTasks: {
|
||||
type: 'boolean',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Include task and cluster details in the response (max 100 elements)',
|
||||
},
|
||||
},
|
||||
|
||||
request: {
|
||||
url: (params) => {
|
||||
const host = params.host
|
||||
.trim()
|
||||
.replace(/^https?:\/\//, '')
|
||||
.replace(/\/$/, '')
|
||||
const url = new URL(`https://${host}/api/2.1/jobs/list`)
|
||||
if (params.limit) url.searchParams.set('limit', String(params.limit))
|
||||
if (params.offset) url.searchParams.set('offset', String(params.offset))
|
||||
if (params.name) url.searchParams.set('name', params.name)
|
||||
if (params.expandTasks) url.searchParams.set('expand_tasks', 'true')
|
||||
return url.toString()
|
||||
},
|
||||
method: 'GET',
|
||||
headers: (params) => ({
|
||||
Accept: 'application/json',
|
||||
Authorization: `Bearer ${params.apiKey}`,
|
||||
}),
|
||||
},
|
||||
|
||||
transformResponse: async (response: Response) => {
|
||||
const data = await response.json()
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error(data.message || data.error?.message || 'Failed to list jobs')
|
||||
}
|
||||
|
||||
const jobs = (data.jobs ?? []).map(
|
||||
(job: {
|
||||
job_id?: number
|
||||
settings?: { name?: string; max_concurrent_runs?: number; format?: string }
|
||||
created_time?: number
|
||||
creator_user_name?: string
|
||||
}) => ({
|
||||
jobId: job.job_id ?? 0,
|
||||
name: job.settings?.name ?? '',
|
||||
createdTime: job.created_time ?? 0,
|
||||
creatorUserName: job.creator_user_name ?? '',
|
||||
maxConcurrentRuns: job.settings?.max_concurrent_runs ?? 1,
|
||||
format: job.settings?.format ?? '',
|
||||
})
|
||||
)
|
||||
|
||||
return {
|
||||
success: true,
|
||||
output: {
|
||||
jobs,
|
||||
hasMore: data.has_more ?? false,
|
||||
nextPageToken: data.next_page_token ?? null,
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
outputs: {
|
||||
jobs: {
|
||||
type: 'array',
|
||||
description: 'List of jobs in the workspace',
|
||||
items: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
jobId: { type: 'number', description: 'Unique job identifier' },
|
||||
name: { type: 'string', description: 'Job name' },
|
||||
createdTime: { type: 'number', description: 'Job creation timestamp (epoch ms)' },
|
||||
creatorUserName: { type: 'string', description: 'Email of the job creator' },
|
||||
maxConcurrentRuns: { type: 'number', description: 'Maximum number of concurrent runs' },
|
||||
format: { type: 'string', description: 'Job format (SINGLE_TASK or MULTI_TASK)' },
|
||||
},
|
||||
},
|
||||
},
|
||||
hasMore: {
|
||||
type: 'boolean',
|
||||
description: 'Whether more jobs are available for pagination',
|
||||
},
|
||||
nextPageToken: {
|
||||
type: 'string',
|
||||
description: 'Token for fetching the next page of results',
|
||||
optional: true,
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,198 @@
|
||||
import type { DatabricksListRunsParams, DatabricksListRunsResponse } from '@/tools/databricks/types'
|
||||
import type { ToolConfig } from '@/tools/types'
|
||||
|
||||
export const listRunsTool: ToolConfig<DatabricksListRunsParams, DatabricksListRunsResponse> = {
|
||||
id: 'databricks_list_runs',
|
||||
name: 'Databricks List Runs',
|
||||
description:
|
||||
'List job runs in a Databricks workspace with optional filtering by job, status, and time range.',
|
||||
version: '1.0.0',
|
||||
|
||||
params: {
|
||||
host: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
description: 'Databricks workspace host (e.g., dbc-abc123.cloud.databricks.com)',
|
||||
},
|
||||
apiKey: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
description: 'Databricks Personal Access Token',
|
||||
},
|
||||
jobId: {
|
||||
type: 'number',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Filter runs by job ID. Omit to list runs across all jobs',
|
||||
},
|
||||
activeOnly: {
|
||||
type: 'boolean',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Only include active runs (PENDING, RUNNING, or TERMINATING)',
|
||||
},
|
||||
completedOnly: {
|
||||
type: 'boolean',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Only include completed runs',
|
||||
},
|
||||
limit: {
|
||||
type: 'number',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Maximum number of runs to return (range 1-24, default 20)',
|
||||
},
|
||||
offset: {
|
||||
type: 'number',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Offset for pagination',
|
||||
},
|
||||
runType: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Filter by run type (JOB_RUN, WORKFLOW_RUN, SUBMIT_RUN)',
|
||||
},
|
||||
startTimeFrom: {
|
||||
type: 'number',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Filter runs started at or after this timestamp (epoch ms)',
|
||||
},
|
||||
startTimeTo: {
|
||||
type: 'number',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Filter runs started at or before this timestamp (epoch ms)',
|
||||
},
|
||||
},
|
||||
|
||||
request: {
|
||||
url: (params) => {
|
||||
const host = params.host
|
||||
.trim()
|
||||
.replace(/^https?:\/\//, '')
|
||||
.replace(/\/$/, '')
|
||||
const url = new URL(`https://${host}/api/2.1/jobs/runs/list`)
|
||||
if (params.jobId) url.searchParams.set('job_id', String(params.jobId))
|
||||
if (params.activeOnly) url.searchParams.set('active_only', 'true')
|
||||
if (params.completedOnly) url.searchParams.set('completed_only', 'true')
|
||||
if (params.limit) url.searchParams.set('limit', String(params.limit))
|
||||
if (params.offset) url.searchParams.set('offset', String(params.offset))
|
||||
if (params.runType) url.searchParams.set('run_type', params.runType)
|
||||
if (params.startTimeFrom)
|
||||
url.searchParams.set('start_time_from', String(params.startTimeFrom))
|
||||
if (params.startTimeTo) url.searchParams.set('start_time_to', String(params.startTimeTo))
|
||||
return url.toString()
|
||||
},
|
||||
method: 'GET',
|
||||
headers: (params) => ({
|
||||
Accept: 'application/json',
|
||||
Authorization: `Bearer ${params.apiKey}`,
|
||||
}),
|
||||
},
|
||||
|
||||
transformResponse: async (response: Response) => {
|
||||
const data = await response.json()
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error(data.message || data.error?.message || 'Failed to list runs')
|
||||
}
|
||||
|
||||
const runs = (data.runs ?? []).map(
|
||||
(run: {
|
||||
run_id?: number
|
||||
job_id?: number
|
||||
run_name?: string
|
||||
run_type?: string
|
||||
state?: {
|
||||
life_cycle_state?: string
|
||||
result_state?: string
|
||||
state_message?: string
|
||||
user_cancelled_or_timedout?: boolean
|
||||
}
|
||||
start_time?: number
|
||||
end_time?: number
|
||||
}) => ({
|
||||
runId: run.run_id ?? 0,
|
||||
jobId: run.job_id ?? 0,
|
||||
runName: run.run_name ?? '',
|
||||
runType: run.run_type ?? '',
|
||||
state: {
|
||||
lifeCycleState: run.state?.life_cycle_state ?? 'UNKNOWN',
|
||||
resultState: run.state?.result_state ?? null,
|
||||
stateMessage: run.state?.state_message ?? '',
|
||||
userCancelledOrTimedout: run.state?.user_cancelled_or_timedout ?? false,
|
||||
},
|
||||
startTime: run.start_time ?? null,
|
||||
endTime: run.end_time ?? null,
|
||||
})
|
||||
)
|
||||
|
||||
return {
|
||||
success: true,
|
||||
output: {
|
||||
runs,
|
||||
hasMore: data.has_more ?? false,
|
||||
nextPageToken: data.next_page_token ?? null,
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
outputs: {
|
||||
runs: {
|
||||
type: 'array',
|
||||
description: 'List of job runs',
|
||||
items: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
runId: { type: 'number', description: 'Unique run identifier' },
|
||||
jobId: { type: 'number', description: 'Job this run belongs to' },
|
||||
runName: { type: 'string', description: 'Run name' },
|
||||
runType: { type: 'string', description: 'Run type (JOB_RUN, WORKFLOW_RUN, SUBMIT_RUN)' },
|
||||
state: {
|
||||
type: 'object',
|
||||
description: 'Run state information',
|
||||
properties: {
|
||||
lifeCycleState: {
|
||||
type: 'string',
|
||||
description:
|
||||
'Lifecycle state (QUEUED, PENDING, RUNNING, TERMINATING, TERMINATED, SKIPPED, INTERNAL_ERROR, BLOCKED, WAITING_FOR_RETRY)',
|
||||
},
|
||||
resultState: {
|
||||
type: 'string',
|
||||
description:
|
||||
'Result state (SUCCESS, FAILED, TIMEDOUT, CANCELED, SUCCESS_WITH_FAILURES, UPSTREAM_FAILED, UPSTREAM_CANCELED, EXCLUDED)',
|
||||
optional: true,
|
||||
},
|
||||
stateMessage: { type: 'string', description: 'Descriptive state message' },
|
||||
userCancelledOrTimedout: {
|
||||
type: 'boolean',
|
||||
description: 'Whether the run was cancelled by user or timed out',
|
||||
},
|
||||
},
|
||||
},
|
||||
startTime: {
|
||||
type: 'number',
|
||||
description: 'Run start timestamp (epoch ms)',
|
||||
optional: true,
|
||||
},
|
||||
endTime: { type: 'number', description: 'Run end timestamp (epoch ms)', optional: true },
|
||||
},
|
||||
},
|
||||
},
|
||||
hasMore: {
|
||||
type: 'boolean',
|
||||
description: 'Whether more runs are available for pagination',
|
||||
},
|
||||
nextPageToken: {
|
||||
type: 'string',
|
||||
description: 'Token for fetching the next page of results',
|
||||
optional: true,
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,127 @@
|
||||
import type {
|
||||
DatabricksBaseParams,
|
||||
DatabricksListWarehousesResponse,
|
||||
} from '@/tools/databricks/types'
|
||||
import type { ToolConfig } from '@/tools/types'
|
||||
|
||||
export const listWarehousesTool: ToolConfig<
|
||||
DatabricksBaseParams,
|
||||
DatabricksListWarehousesResponse
|
||||
> = {
|
||||
id: 'databricks_list_warehouses',
|
||||
name: 'Databricks List Warehouses',
|
||||
description:
|
||||
'List all SQL warehouses in a Databricks workspace including their size, state, and type. Use this to discover the warehouse ID needed for Execute SQL.',
|
||||
version: '1.0.0',
|
||||
|
||||
params: {
|
||||
host: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
description: 'Databricks workspace host (e.g., dbc-abc123.cloud.databricks.com)',
|
||||
},
|
||||
apiKey: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
description: 'Databricks Personal Access Token',
|
||||
},
|
||||
},
|
||||
|
||||
request: {
|
||||
url: (params) => {
|
||||
const host = params.host
|
||||
.trim()
|
||||
.replace(/^https?:\/\//, '')
|
||||
.replace(/\/$/, '')
|
||||
return `https://${host}/api/2.0/sql/warehouses`
|
||||
},
|
||||
method: 'GET',
|
||||
headers: (params) => ({
|
||||
Accept: 'application/json',
|
||||
Authorization: `Bearer ${params.apiKey}`,
|
||||
}),
|
||||
},
|
||||
|
||||
transformResponse: async (response: Response) => {
|
||||
const data = await response.json()
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error(data.message || data.error?.message || 'Failed to list warehouses')
|
||||
}
|
||||
|
||||
const warehouses = (data.warehouses ?? []).map(
|
||||
(warehouse: {
|
||||
id?: string
|
||||
name?: string
|
||||
cluster_size?: string
|
||||
state?: string
|
||||
warehouse_type?: string
|
||||
creator_name?: string
|
||||
auto_stop_mins?: number
|
||||
num_clusters?: number
|
||||
min_num_clusters?: number
|
||||
max_num_clusters?: number
|
||||
num_active_sessions?: number
|
||||
enable_serverless_compute?: boolean
|
||||
}) => ({
|
||||
warehouseId: warehouse.id ?? '',
|
||||
name: warehouse.name ?? '',
|
||||
clusterSize: warehouse.cluster_size ?? '',
|
||||
state: warehouse.state ?? 'UNKNOWN',
|
||||
warehouseType: warehouse.warehouse_type ?? '',
|
||||
creatorName: warehouse.creator_name ?? '',
|
||||
autoStopMinutes: warehouse.auto_stop_mins ?? 0,
|
||||
numClusters: warehouse.num_clusters ?? 0,
|
||||
minNumClusters: warehouse.min_num_clusters ?? 0,
|
||||
maxNumClusters: warehouse.max_num_clusters ?? 0,
|
||||
numActiveSessions: warehouse.num_active_sessions ?? 0,
|
||||
enableServerlessCompute: warehouse.enable_serverless_compute ?? false,
|
||||
})
|
||||
)
|
||||
|
||||
return {
|
||||
success: true,
|
||||
output: {
|
||||
warehouses,
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
outputs: {
|
||||
warehouses: {
|
||||
type: 'array',
|
||||
description: 'List of SQL warehouses in the workspace',
|
||||
items: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
warehouseId: { type: 'string', description: 'Unique warehouse identifier' },
|
||||
name: { type: 'string', description: 'Warehouse display name' },
|
||||
clusterSize: {
|
||||
type: 'string',
|
||||
description: 'Warehouse size (e.g., 2X-Small, Small, Medium, Large)',
|
||||
},
|
||||
state: {
|
||||
type: 'string',
|
||||
description: 'Current state (STARTING, RUNNING, STOPPING, STOPPED, DELETING, DELETED)',
|
||||
},
|
||||
warehouseType: { type: 'string', description: 'Warehouse type (CLASSIC, PRO)' },
|
||||
creatorName: { type: 'string', description: 'Email of the warehouse creator' },
|
||||
autoStopMinutes: {
|
||||
type: 'number',
|
||||
description: 'Minutes of inactivity before auto-stop (0 = disabled)',
|
||||
},
|
||||
numClusters: { type: 'number', description: 'Current number of running clusters' },
|
||||
minNumClusters: { type: 'number', description: 'Minimum cluster count for scaling' },
|
||||
maxNumClusters: { type: 'number', description: 'Maximum cluster count for scaling' },
|
||||
numActiveSessions: { type: 'number', description: 'Number of active sessions' },
|
||||
enableServerlessCompute: {
|
||||
type: 'boolean',
|
||||
description: 'Whether serverless compute is enabled',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,117 @@
|
||||
import { getErrorMessage } from '@sim/utils/errors'
|
||||
import type { DatabricksRunJobParams, DatabricksRunJobResponse } from '@/tools/databricks/types'
|
||||
import type { ToolConfig } from '@/tools/types'
|
||||
|
||||
export const runJobTool: ToolConfig<DatabricksRunJobParams, DatabricksRunJobResponse> = {
|
||||
id: 'databricks_run_job',
|
||||
name: 'Databricks Run Job',
|
||||
description:
|
||||
'Trigger an existing Databricks job to run immediately with optional job-level or notebook parameters.',
|
||||
version: '1.0.0',
|
||||
|
||||
params: {
|
||||
host: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
description: 'Databricks workspace host (e.g., dbc-abc123.cloud.databricks.com)',
|
||||
},
|
||||
apiKey: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
description: 'Databricks Personal Access Token',
|
||||
},
|
||||
jobId: {
|
||||
type: 'number',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The ID of the job to trigger',
|
||||
},
|
||||
jobParameters: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Job-level parameter overrides as a JSON object (e.g., {"key": "value"})',
|
||||
},
|
||||
notebookParams: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Notebook task parameters as a JSON object (e.g., {"param1": "value1"})',
|
||||
},
|
||||
idempotencyToken: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Idempotency token to prevent duplicate runs (max 64 characters)',
|
||||
},
|
||||
},
|
||||
|
||||
request: {
|
||||
url: (params) => {
|
||||
const host = params.host
|
||||
.trim()
|
||||
.replace(/^https?:\/\//, '')
|
||||
.replace(/\/$/, '')
|
||||
return `https://${host}/api/2.1/jobs/run-now`
|
||||
},
|
||||
method: 'POST',
|
||||
headers: (params) => ({
|
||||
'Content-Type': 'application/json',
|
||||
Authorization: `Bearer ${params.apiKey}`,
|
||||
}),
|
||||
body: (params) => {
|
||||
const body: Record<string, unknown> = {
|
||||
job_id: params.jobId,
|
||||
}
|
||||
if (params.jobParameters) {
|
||||
try {
|
||||
body.job_parameters = JSON.parse(params.jobParameters)
|
||||
} catch (error) {
|
||||
throw new Error(
|
||||
`Invalid JSON in jobParameters: ${getErrorMessage(error, 'unknown error')}`
|
||||
)
|
||||
}
|
||||
}
|
||||
if (params.notebookParams) {
|
||||
try {
|
||||
body.notebook_params = JSON.parse(params.notebookParams)
|
||||
} catch (error) {
|
||||
throw new Error(
|
||||
`Invalid JSON in notebookParams: ${getErrorMessage(error, 'unknown error')}`
|
||||
)
|
||||
}
|
||||
}
|
||||
if (params.idempotencyToken) body.idempotency_token = params.idempotencyToken
|
||||
return body
|
||||
},
|
||||
},
|
||||
|
||||
transformResponse: async (response: Response) => {
|
||||
const data = await response.json()
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error(data.message || data.error?.message || 'Failed to trigger job run')
|
||||
}
|
||||
|
||||
return {
|
||||
success: true,
|
||||
output: {
|
||||
runId: data.run_id ?? 0,
|
||||
numberInJob: data.number_in_job ?? 0,
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
outputs: {
|
||||
runId: {
|
||||
type: 'number',
|
||||
description: 'The globally unique ID of the triggered run',
|
||||
},
|
||||
numberInJob: {
|
||||
type: 'number',
|
||||
description: 'The sequence number of this run among all runs of the job',
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,254 @@
|
||||
import type { ToolResponse } from '@/tools/types'
|
||||
|
||||
/** Base parameters shared by all Databricks tools */
|
||||
export interface DatabricksBaseParams {
|
||||
apiKey: string
|
||||
host: string
|
||||
}
|
||||
|
||||
/** Execute SQL Statement */
|
||||
export interface DatabricksExecuteSqlParams extends DatabricksBaseParams {
|
||||
warehouseId: string
|
||||
statement: string
|
||||
catalog?: string
|
||||
schema?: string
|
||||
rowLimit?: number
|
||||
waitTimeout?: string
|
||||
}
|
||||
|
||||
export interface DatabricksExecuteSqlResponse extends ToolResponse {
|
||||
output: {
|
||||
statementId: string
|
||||
status: string
|
||||
columns: Array<{ name: string; position: number; typeName: string }> | null
|
||||
data: string[][] | null
|
||||
totalRows: number | null
|
||||
truncated: boolean
|
||||
}
|
||||
}
|
||||
|
||||
/** Get Statement (poll an async SQL statement by its ID) */
|
||||
export interface DatabricksGetStatementParams extends DatabricksBaseParams {
|
||||
statementId: string
|
||||
}
|
||||
|
||||
/** List Jobs */
|
||||
export interface DatabricksListJobsParams extends DatabricksBaseParams {
|
||||
limit?: number
|
||||
offset?: number
|
||||
name?: string
|
||||
expandTasks?: boolean
|
||||
}
|
||||
|
||||
export interface DatabricksListJobsResponse extends ToolResponse {
|
||||
output: {
|
||||
jobs: Array<{
|
||||
jobId: number
|
||||
name: string
|
||||
createdTime: number
|
||||
creatorUserName: string
|
||||
maxConcurrentRuns: number
|
||||
format: string
|
||||
}>
|
||||
hasMore: boolean
|
||||
nextPageToken: string | null
|
||||
}
|
||||
}
|
||||
|
||||
/** Run Job */
|
||||
export interface DatabricksRunJobParams extends DatabricksBaseParams {
|
||||
jobId: number
|
||||
jobParameters?: string
|
||||
notebookParams?: string
|
||||
idempotencyToken?: string
|
||||
}
|
||||
|
||||
export interface DatabricksRunJobResponse extends ToolResponse {
|
||||
output: {
|
||||
runId: number
|
||||
numberInJob: number
|
||||
}
|
||||
}
|
||||
|
||||
/** Get Job */
|
||||
export interface DatabricksGetJobParams extends DatabricksBaseParams {
|
||||
jobId: number
|
||||
}
|
||||
|
||||
export interface DatabricksGetJobResponse extends ToolResponse {
|
||||
output: {
|
||||
jobId: number
|
||||
name: string
|
||||
creatorUserName: string
|
||||
runAsUserName: string
|
||||
createdTime: number
|
||||
format: string
|
||||
maxConcurrentRuns: number
|
||||
timeoutSeconds: number | null
|
||||
schedule: Record<string, unknown> | null
|
||||
tags: Record<string, unknown> | null
|
||||
tasks: Array<Record<string, unknown>>
|
||||
}
|
||||
}
|
||||
|
||||
/** Get Run */
|
||||
export interface DatabricksGetRunParams extends DatabricksBaseParams {
|
||||
runId: number
|
||||
includeHistory?: boolean
|
||||
includeResolvedValues?: boolean
|
||||
}
|
||||
|
||||
export interface DatabricksGetRunResponse extends ToolResponse {
|
||||
output: {
|
||||
runId: number
|
||||
jobId: number
|
||||
runName: string
|
||||
runType: string
|
||||
attemptNumber: number
|
||||
state: {
|
||||
lifeCycleState: string
|
||||
resultState: string | null
|
||||
stateMessage: string
|
||||
userCancelledOrTimedout: boolean
|
||||
}
|
||||
startTime: number | null
|
||||
endTime: number | null
|
||||
setupDuration: number | null
|
||||
executionDuration: number | null
|
||||
cleanupDuration: number | null
|
||||
queueDuration: number | null
|
||||
runPageUrl: string
|
||||
creatorUserName: string
|
||||
}
|
||||
}
|
||||
|
||||
/** List Runs */
|
||||
export interface DatabricksListRunsParams extends DatabricksBaseParams {
|
||||
jobId?: number
|
||||
activeOnly?: boolean
|
||||
completedOnly?: boolean
|
||||
limit?: number
|
||||
offset?: number
|
||||
runType?: string
|
||||
startTimeFrom?: number
|
||||
startTimeTo?: number
|
||||
}
|
||||
|
||||
export interface DatabricksListRunsResponse extends ToolResponse {
|
||||
output: {
|
||||
runs: Array<{
|
||||
runId: number
|
||||
jobId: number
|
||||
runName: string
|
||||
runType: string
|
||||
state: {
|
||||
lifeCycleState: string
|
||||
resultState: string | null
|
||||
stateMessage: string
|
||||
userCancelledOrTimedout: boolean
|
||||
}
|
||||
startTime: number | null
|
||||
endTime: number | null
|
||||
}>
|
||||
hasMore: boolean
|
||||
nextPageToken: string | null
|
||||
}
|
||||
}
|
||||
|
||||
/** Cancel Run */
|
||||
export interface DatabricksCancelRunParams extends DatabricksBaseParams {
|
||||
runId: number
|
||||
}
|
||||
|
||||
export interface DatabricksCancelRunResponse extends ToolResponse {
|
||||
output: {
|
||||
success: boolean
|
||||
}
|
||||
}
|
||||
|
||||
/** Get Run Output */
|
||||
export interface DatabricksGetRunOutputParams extends DatabricksBaseParams {
|
||||
runId: number
|
||||
}
|
||||
|
||||
export interface DatabricksGetRunOutputResponse extends ToolResponse {
|
||||
output: {
|
||||
notebookOutput: {
|
||||
result: string | null
|
||||
truncated: boolean
|
||||
} | null
|
||||
error: string | null
|
||||
errorTrace: string | null
|
||||
logs: string | null
|
||||
logsTruncated: boolean
|
||||
}
|
||||
}
|
||||
|
||||
/** Shared cluster shape returned by list_clusters and get_cluster */
|
||||
export interface DatabricksCluster {
|
||||
clusterId: string
|
||||
clusterName: string
|
||||
state: string
|
||||
stateMessage: string
|
||||
creatorUserName: string
|
||||
sparkVersion: string
|
||||
nodeTypeId: string
|
||||
driverNodeTypeId: string
|
||||
numWorkers: number | null
|
||||
autoscale: { minWorkers: number; maxWorkers: number } | null
|
||||
clusterSource: string
|
||||
autoterminationMinutes: number
|
||||
startTime: number | null
|
||||
}
|
||||
|
||||
/** List Clusters */
|
||||
export interface DatabricksListClustersResponse extends ToolResponse {
|
||||
output: {
|
||||
clusters: DatabricksCluster[]
|
||||
}
|
||||
}
|
||||
|
||||
/** Get Cluster */
|
||||
export interface DatabricksGetClusterParams extends DatabricksBaseParams {
|
||||
clusterId: string
|
||||
}
|
||||
|
||||
export interface DatabricksGetClusterResponse extends ToolResponse {
|
||||
output: {
|
||||
cluster: DatabricksCluster
|
||||
}
|
||||
}
|
||||
|
||||
/** List Warehouses */
|
||||
export interface DatabricksListWarehousesResponse extends ToolResponse {
|
||||
output: {
|
||||
warehouses: Array<{
|
||||
warehouseId: string
|
||||
name: string
|
||||
clusterSize: string
|
||||
state: string
|
||||
warehouseType: string
|
||||
creatorName: string
|
||||
autoStopMinutes: number
|
||||
numClusters: number
|
||||
minNumClusters: number
|
||||
maxNumClusters: number
|
||||
numActiveSessions: number
|
||||
enableServerlessCompute: boolean
|
||||
}>
|
||||
}
|
||||
}
|
||||
|
||||
/** Union type for all Databricks responses */
|
||||
export type DatabricksResponse =
|
||||
| DatabricksExecuteSqlResponse
|
||||
| DatabricksListJobsResponse
|
||||
| DatabricksRunJobResponse
|
||||
| DatabricksGetJobResponse
|
||||
| DatabricksGetRunResponse
|
||||
| DatabricksListRunsResponse
|
||||
| DatabricksCancelRunResponse
|
||||
| DatabricksGetRunOutputResponse
|
||||
| DatabricksListClustersResponse
|
||||
| DatabricksGetClusterResponse
|
||||
| DatabricksListWarehousesResponse
|
||||
Reference in New Issue
Block a user