Skip to content

Commit f34dbc4

Browse files
committed
Logs tools
1 parent 186a49a commit f34dbc4

21 files changed

Lines changed: 1792 additions & 969 deletions

apps/sim/app/api/logs/route.ts

Lines changed: 8 additions & 443 deletions
Large diffs are not rendered by default.

apps/sim/app/workspace/[workspaceId]/home/hooks/use-chat.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ import {
5454
DeployMcp,
5555
FunctionExecute,
5656
GetPageContents,
57-
GetWorkflowLogs,
5857
Glob,
5958
Grep,
6059
ManageCredential,
@@ -69,6 +68,7 @@ import {
6968
ManageSkillOperation,
7069
MoveFolder,
7170
MoveWorkflow,
71+
QueryLogs,
7272
Read as ReadTool,
7373
Redeploy,
7474
RenameWorkflow,
@@ -719,9 +719,9 @@ function resolveToolDisplayTitle(name: string, args?: Record<string, unknown>):
719719
return 'Running workflow'
720720
}
721721

722-
if (name === GetWorkflowLogs.id) {
722+
if (name === QueryLogs.id) {
723723
const workflowName = resolveWorkflowNameForDisplay(args.workflowId)
724-
return workflowName ? `Getting logs for ${workflowName}` : 'Getting logs'
724+
return workflowName ? `Querying logs for ${workflowName}` : 'Querying logs'
725725
}
726726

727727
return undefined

apps/sim/lib/copilot/generated/tool-catalog-v1.ts

Lines changed: 108 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,10 @@ export interface ToolCatalogEntry {
4040
| 'get_block_upstream_references'
4141
| 'get_deployed_workflow_state'
4242
| 'get_deployment_version'
43-
| 'get_execution_summary'
4443
| 'get_job_logs'
4544
| 'get_page_contents'
4645
| 'get_platform_actions'
4746
| 'get_workflow_data'
48-
| 'get_workflow_logs'
4947
| 'glob'
5048
| 'grep'
5149
| 'job'
@@ -69,6 +67,7 @@ export interface ToolCatalogEntry {
6967
| 'oauth_get_auth_link'
7068
| 'oauth_request_access'
7169
| 'open_resource'
70+
| 'query_logs'
7271
| 'read'
7372
| 'redeploy'
7473
| 'rename_file'
@@ -136,12 +135,10 @@ export interface ToolCatalogEntry {
136135
| 'get_block_upstream_references'
137136
| 'get_deployed_workflow_state'
138137
| 'get_deployment_version'
139-
| 'get_execution_summary'
140138
| 'get_job_logs'
141139
| 'get_page_contents'
142140
| 'get_platform_actions'
143141
| 'get_workflow_data'
144-
| 'get_workflow_logs'
145142
| 'glob'
146143
| 'grep'
147144
| 'job'
@@ -165,6 +162,7 @@ export interface ToolCatalogEntry {
165162
| 'oauth_get_auth_link'
166163
| 'oauth_request_access'
167164
| 'open_resource'
165+
| 'query_logs'
168166
| 'read'
169167
| 'redeploy'
170168
| 'rename_file'
@@ -1486,34 +1484,6 @@ export const GetDeploymentVersion: ToolCatalogEntry = {
14861484
},
14871485
}
14881486

1489-
export const GetExecutionSummary: ToolCatalogEntry = {
1490-
id: 'get_execution_summary',
1491-
name: 'get_execution_summary',
1492-
route: 'sim',
1493-
mode: 'async',
1494-
parameters: {
1495-
type: 'object',
1496-
properties: {
1497-
limit: {
1498-
type: 'number',
1499-
description: 'Max number of executions to return (default: 10, max: 20).',
1500-
},
1501-
status: {
1502-
type: 'string',
1503-
description: "Filter by status: 'success', 'error', or 'all' (default: 'all').",
1504-
enum: ['success', 'error', 'all'],
1505-
},
1506-
workflowId: {
1507-
type: 'string',
1508-
description:
1509-
'Optional workflow ID. If omitted, returns executions across all workflows in the workspace.',
1510-
},
1511-
workspaceId: { type: 'string', description: 'Workspace ID to scope executions to.' },
1512-
},
1513-
required: ['workspaceId'],
1514-
},
1515-
}
1516-
15171487
export const GetJobLogs: ToolCatalogEntry = {
15181488
id: 'get_job_logs',
15191489
name: 'get_job_logs',
@@ -1591,29 +1561,6 @@ export const GetWorkflowData: ToolCatalogEntry = {
15911561
},
15921562
}
15931563

1594-
export const GetWorkflowLogs: ToolCatalogEntry = {
1595-
id: 'get_workflow_logs',
1596-
name: 'get_workflow_logs',
1597-
route: 'sim',
1598-
mode: 'async',
1599-
parameters: {
1600-
type: 'object',
1601-
properties: {
1602-
executionId: {
1603-
type: 'string',
1604-
description:
1605-
'Optional execution ID to get logs for a specific execution. Use with get_execution_summary to find execution IDs first.',
1606-
},
1607-
includeDetails: { type: 'boolean', description: 'Include detailed info' },
1608-
limit: { type: 'number', description: 'Max number of entries (hard limit: 3)' },
1609-
workflowId: {
1610-
type: 'string',
1611-
description: 'Optional workflow ID. If not provided, uses the current workflow in context.',
1612-
},
1613-
},
1614-
},
1615-
}
1616-
16171564
export const Glob: ToolCatalogEntry = {
16181565
id: 'glob',
16191566
name: 'glob',
@@ -2405,6 +2352,111 @@ export const OpenResource: ToolCatalogEntry = {
24052352
},
24062353
}
24072354

2355+
export const QueryLogs: ToolCatalogEntry = {
2356+
id: 'query_logs',
2357+
name: 'query_logs',
2358+
route: 'sim',
2359+
mode: 'async',
2360+
parameters: {
2361+
type: 'object',
2362+
properties: {
2363+
blockId: {
2364+
type: 'string',
2365+
description: "Optional (view='full'): only return this block's span subtree.",
2366+
},
2367+
blockName: {
2368+
type: 'string',
2369+
description: "Optional (view='full'): only return spans for this block name.",
2370+
},
2371+
costOperator: {
2372+
type: 'string',
2373+
description: "Filter (view='list'): comparison operator for cost.",
2374+
enum: ['=', '>', '<', '>=', '<=', '!='],
2375+
},
2376+
costValue: {
2377+
type: 'number',
2378+
description: "Filter (view='list'): cost threshold paired with costOperator.",
2379+
},
2380+
cursor: {
2381+
type: 'string',
2382+
description: "Pagination cursor (view='list') from a prior response's nextCursor.",
2383+
},
2384+
durationOperator: {
2385+
type: 'string',
2386+
description: "Filter (view='list'): comparison operator for duration (ms).",
2387+
enum: ['=', '>', '<', '>=', '<=', '!='],
2388+
},
2389+
durationValue: {
2390+
type: 'number',
2391+
description: "Filter (view='list'): duration threshold (ms) paired with durationOperator.",
2392+
},
2393+
endDate: { type: 'string', description: "Filter (view='list'): ISO end of the time range." },
2394+
executionId: {
2395+
type: 'string',
2396+
description:
2397+
"Required for 'overview'/'full' (and 'pattern'): the execution to read. For 'list', an optional exact-match filter.",
2398+
},
2399+
folderIds: {
2400+
type: 'string',
2401+
description: "Filter (view='list'): comma-separated folder IDs (descendants included).",
2402+
},
2403+
folderName: {
2404+
type: 'string',
2405+
description: "Filter (view='list'): substring match on folder name.",
2406+
},
2407+
level: {
2408+
type: 'string',
2409+
description:
2410+
"Filter (view='list'): comma-separated levels: error, info, running, pending. Default all.",
2411+
},
2412+
limit: { type: 'number', description: "Max results (view='list'), 1-200 (default 100)." },
2413+
pattern: {
2414+
type: 'string',
2415+
description:
2416+
"Optional substring/regex to grep within the execution's trace spans (requires executionId). Returns matching spans with snippets instead of the full log.",
2417+
},
2418+
search: {
2419+
type: 'string',
2420+
description: "Filter (view='list'): substring match on executionId.",
2421+
},
2422+
sortBy: {
2423+
type: 'string',
2424+
description: "Sort field (view='list').",
2425+
enum: ['date', 'duration', 'cost', 'status'],
2426+
},
2427+
sortOrder: {
2428+
type: 'string',
2429+
description: "Sort order (view='list').",
2430+
enum: ['asc', 'desc'],
2431+
},
2432+
startDate: {
2433+
type: 'string',
2434+
description: "Filter (view='list'): ISO start of the time range.",
2435+
},
2436+
triggers: {
2437+
type: 'string',
2438+
description: "Filter (view='list'): comma-separated trigger types.",
2439+
},
2440+
view: {
2441+
type: 'string',
2442+
description:
2443+
"Disclosure level: 'list' (summaries), 'overview' (one execution's trace tree, no I/O), or 'full' (one execution's trace spans with I/O).",
2444+
enum: ['list', 'overview', 'full'],
2445+
},
2446+
workflowIds: {
2447+
type: 'string',
2448+
description: "Filter (view='list'): comma-separated workflow IDs.",
2449+
},
2450+
workflowName: {
2451+
type: 'string',
2452+
description: "Filter (view='list'): substring match on workflow name.",
2453+
},
2454+
workspaceId: { type: 'string', description: 'Workspace ID to scope to.' },
2455+
},
2456+
required: ['view'],
2457+
},
2458+
}
2459+
24082460
export const Read: ToolCatalogEntry = {
24092461
id: 'read',
24102462
name: 'read',
@@ -3875,12 +3927,10 @@ export const TOOL_CATALOG: Record<string, ToolCatalogEntry> = {
38753927
[GetBlockUpstreamReferences.id]: GetBlockUpstreamReferences,
38763928
[GetDeployedWorkflowState.id]: GetDeployedWorkflowState,
38773929
[GetDeploymentVersion.id]: GetDeploymentVersion,
3878-
[GetExecutionSummary.id]: GetExecutionSummary,
38793930
[GetJobLogs.id]: GetJobLogs,
38803931
[GetPageContents.id]: GetPageContents,
38813932
[GetPlatformActions.id]: GetPlatformActions,
38823933
[GetWorkflowData.id]: GetWorkflowData,
3883-
[GetWorkflowLogs.id]: GetWorkflowLogs,
38843934
[Glob.id]: Glob,
38853935
[Grep.id]: Grep,
38863936
[Job.id]: Job,
@@ -3904,6 +3954,7 @@ export const TOOL_CATALOG: Record<string, ToolCatalogEntry> = {
39043954
[OauthGetAuthLink.id]: OauthGetAuthLink,
39053955
[OauthRequestAccess.id]: OauthRequestAccess,
39063956
[OpenResource.id]: OpenResource,
3957+
[QueryLogs.id]: QueryLogs,
39073958
[Read.id]: Read,
39083959
[Redeploy.id]: Redeploy,
39093960
[RenameFile.id]: RenameFile,

0 commit comments

Comments
 (0)