Skip to content

Commit af865eb

Browse files
committed
fix(databricks): align tool inputs/outputs with official API spec
- execute_sql: fix wait_timeout default description (50s, not 10s) - get_run: add queueDuration field, update lifecycle/result state enums - get_run_output: fix notebook output size (5 MB not 1 MB), add logsTruncated field - list_runs: add userCancelledOrTimedout to state, fix limit range (1-24), update state enums - list_jobs: fix name filter description to "exact case-insensitive" - list_clusters: add PIPELINE_MAINTENANCE to ClusterSource enum
1 parent fcf88e0 commit af865eb

File tree

8 files changed

+40
-12
lines changed

8 files changed

+40
-12
lines changed

apps/sim/blocks/blocks/databricks.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ export const DatabricksBlock: BlockConfig<DatabricksResponse> = {
8787
id: 'name',
8888
title: 'Job Name Filter',
8989
type: 'short-input',
90-
placeholder: 'Filter by name (case-insensitive)',
90+
placeholder: 'Exact name filter (case-insensitive)',
9191
condition: { field: 'operation', value: 'list_jobs' },
9292
},
9393
{
@@ -399,6 +399,7 @@ Return ONLY the numeric timestamp in milliseconds - no explanations, no extra te
399399
setupDuration: { type: 'number', description: 'Cluster setup duration (ms)' },
400400
executionDuration: { type: 'number', description: 'Execution duration (ms)' },
401401
cleanupDuration: { type: 'number', description: 'Cleanup duration (ms)' },
402+
queueDuration: { type: 'number', description: 'Time spent in queue (ms)' },
402403
runPageUrl: { type: 'string', description: 'URL to run detail page' },
403404
creatorUserName: { type: 'string', description: 'Run creator email' },
404405
// List Runs
@@ -410,6 +411,7 @@ Return ONLY the numeric timestamp in milliseconds - no explanations, no extra te
410411
error: { type: 'string', description: 'Error message if run failed' },
411412
errorTrace: { type: 'string', description: 'Error stack trace' },
412413
logs: { type: 'string', description: 'Run log output' },
414+
logsTruncated: { type: 'boolean', description: 'Whether logs were truncated' },
413415
// List Clusters
414416
clusters: { type: 'json', description: 'List of clusters' },
415417
},

apps/sim/tools/databricks/execute_sql.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ export const executeSqlTool: ToolConfig<DatabricksExecuteSqlParams, DatabricksEx
6060
required: false,
6161
visibility: 'user-or-llm',
6262
description:
63-
'How long to wait for results (e.g., "50s"). Range: "0s" or "5s" to "50s". Default: "10s"',
63+
'How long to wait for results (e.g., "50s"). Range: "0s" or "5s" to "50s". Default: "50s"',
6464
},
6565
},
6666

apps/sim/tools/databricks/get_run.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ export const getRunTool: ToolConfig<DatabricksGetRunParams, DatabricksGetRunResp
8282
setupDuration: data.setup_duration ?? null,
8383
executionDuration: data.execution_duration ?? null,
8484
cleanupDuration: data.cleanup_duration ?? null,
85+
queueDuration: data.queue_duration ?? null,
8586
runPageUrl: data.run_page_url ?? '',
8687
creatorUserName: data.creator_user_name ?? '',
8788
},
@@ -116,11 +117,12 @@ export const getRunTool: ToolConfig<DatabricksGetRunParams, DatabricksGetRunResp
116117
lifeCycleState: {
117118
type: 'string',
118119
description:
119-
'Lifecycle state (QUEUED, PENDING, RUNNING, TERMINATING, TERMINATED, SKIPPED, INTERNAL_ERROR)',
120+
'Lifecycle state (QUEUED, PENDING, RUNNING, TERMINATING, TERMINATED, SKIPPED, INTERNAL_ERROR, BLOCKED, WAITING_FOR_RETRY)',
120121
},
121122
resultState: {
122123
type: 'string',
123-
description: 'Result state (SUCCESS, FAILED, TIMEDOUT, CANCELED)',
124+
description:
125+
'Result state (SUCCESS, FAILED, TIMEDOUT, CANCELED, SUCCESS_WITH_FAILURES, UPSTREAM_FAILED, UPSTREAM_CANCELED, EXCLUDED)',
124126
optional: true,
125127
},
126128
stateMessage: {
@@ -158,6 +160,11 @@ export const getRunTool: ToolConfig<DatabricksGetRunParams, DatabricksGetRunResp
158160
description: 'Cleanup duration (ms)',
159161
optional: true,
160162
},
163+
queueDuration: {
164+
type: 'number',
165+
description: 'Time spent in queue before execution (ms)',
166+
optional: true,
167+
},
161168
runPageUrl: {
162169
type: 'string',
163170
description: 'URL to the run detail page in Databricks UI',

apps/sim/tools/databricks/get_run_output.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ export const getRunOutputTool: ToolConfig<
6666
error: data.error ?? null,
6767
errorTrace: data.error_trace ?? null,
6868
logs: data.logs ?? null,
69+
logsTruncated: data.logs_truncated ?? false,
6970
},
7071
}
7172
},
@@ -78,7 +79,7 @@ export const getRunOutputTool: ToolConfig<
7879
properties: {
7980
result: {
8081
type: 'string',
81-
description: 'Value passed to dbutils.notebook.exit() (max 1 MB)',
82+
description: 'Value passed to dbutils.notebook.exit() (max 5 MB)',
8283
optional: true,
8384
},
8485
truncated: {
@@ -99,8 +100,12 @@ export const getRunOutputTool: ToolConfig<
99100
},
100101
logs: {
101102
type: 'string',
102-
description: 'Log output from the run if available',
103+
description: 'Log output (last 5 MB) from spark_jar, spark_python, or python_wheel tasks',
103104
optional: true,
104105
},
106+
logsTruncated: {
107+
type: 'boolean',
108+
description: 'Whether the log output was truncated',
109+
},
105110
},
106111
}

apps/sim/tools/databricks/list_clusters.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ export const listClustersTool: ToolConfig<DatabricksBaseParams, DatabricksListCl
125125
},
126126
clusterSource: {
127127
type: 'string',
128-
description: 'Origin (API, UI, JOB, MODELS, PIPELINE, SQL)',
128+
description: 'Origin (API, UI, JOB, MODELS, PIPELINE, PIPELINE_MAINTENANCE, SQL)',
129129
},
130130
autoterminationMinutes: {
131131
type: 'number',

apps/sim/tools/databricks/list_jobs.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export const listJobsTool: ToolConfig<DatabricksListJobsParams, DatabricksListJo
3636
type: 'string',
3737
required: false,
3838
visibility: 'user-or-llm',
39-
description: 'Filter jobs by name (case-insensitive match)',
39+
description: 'Filter jobs by exact name (case-insensitive)',
4040
},
4141
expandTasks: {
4242
type: 'boolean',

apps/sim/tools/databricks/list_runs.ts

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ export const listRunsTool: ToolConfig<DatabricksListRunsParams, DatabricksListRu
4343
type: 'number',
4444
required: false,
4545
visibility: 'user-or-llm',
46-
description: 'Maximum number of runs to return (range 1-25, default 20)',
46+
description: 'Maximum number of runs to return (range 1-24, default 20)',
4747
},
4848
offset: {
4949
type: 'number',
@@ -106,7 +106,12 @@ export const listRunsTool: ToolConfig<DatabricksListRunsParams, DatabricksListRu
106106
job_id?: number
107107
run_name?: string
108108
run_type?: string
109-
state?: { life_cycle_state?: string; result_state?: string; state_message?: string }
109+
state?: {
110+
life_cycle_state?: string
111+
result_state?: string
112+
state_message?: string
113+
user_cancelled_or_timedout?: boolean
114+
}
110115
start_time?: number
111116
end_time?: number
112117
}) => ({
@@ -118,6 +123,7 @@ export const listRunsTool: ToolConfig<DatabricksListRunsParams, DatabricksListRu
118123
lifeCycleState: run.state?.life_cycle_state ?? 'UNKNOWN',
119124
resultState: run.state?.result_state ?? null,
120125
stateMessage: run.state?.state_message ?? '',
126+
userCancelledOrTimedout: run.state?.user_cancelled_or_timedout ?? false,
121127
},
122128
startTime: run.start_time ?? null,
123129
endTime: run.end_time ?? null,
@@ -152,14 +158,19 @@ export const listRunsTool: ToolConfig<DatabricksListRunsParams, DatabricksListRu
152158
lifeCycleState: {
153159
type: 'string',
154160
description:
155-
'Lifecycle state (QUEUED, PENDING, RUNNING, TERMINATING, TERMINATED, SKIPPED, INTERNAL_ERROR)',
161+
'Lifecycle state (QUEUED, PENDING, RUNNING, TERMINATING, TERMINATED, SKIPPED, INTERNAL_ERROR, BLOCKED, WAITING_FOR_RETRY)',
156162
},
157163
resultState: {
158164
type: 'string',
159-
description: 'Result state (SUCCESS, FAILED, TIMEDOUT, CANCELED)',
165+
description:
166+
'Result state (SUCCESS, FAILED, TIMEDOUT, CANCELED, SUCCESS_WITH_FAILURES, UPSTREAM_FAILED, UPSTREAM_CANCELED, EXCLUDED)',
160167
optional: true,
161168
},
162169
stateMessage: { type: 'string', description: 'Descriptive state message' },
170+
userCancelledOrTimedout: {
171+
type: 'boolean',
172+
description: 'Whether the run was cancelled by user or timed out',
173+
},
163174
},
164175
},
165176
startTime: {

apps/sim/tools/databricks/types.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ export interface DatabricksGetRunResponse extends ToolResponse {
9090
setupDuration: number | null
9191
executionDuration: number | null
9292
cleanupDuration: number | null
93+
queueDuration: number | null
9394
runPageUrl: string
9495
creatorUserName: string
9596
}
@@ -118,6 +119,7 @@ export interface DatabricksListRunsResponse extends ToolResponse {
118119
lifeCycleState: string
119120
resultState: string | null
120121
stateMessage: string
122+
userCancelledOrTimedout: boolean
121123
}
122124
startTime: number | null
123125
endTime: number | null
@@ -152,6 +154,7 @@ export interface DatabricksGetRunOutputResponse extends ToolResponse {
152154
error: string | null
153155
errorTrace: string | null
154156
logs: string | null
157+
logsTruncated: boolean
155158
}
156159
}
157160

0 commit comments

Comments
 (0)