improvement(tools): removed transformError, isInternalRoute, directEx… · simstudioai/sim@56ede1c · GitHub
Skip to content

Commit 56ede1c

Browse files
authored
improvement(tools): removed transformError, isInternalRoute, directExecution (#928)
* standardized response format for transformError * removed trasnformError, moved error handling to executeTool for all different error formats * remove isInternalRoute, make it implicit in executeTool * removed directExecution, everything on the server nothing on the client * fix supabase * fix(tag-dropdown): fix values for parallel & loop blocks (#929) * fix(search-modal): add parallel and loop blocks to search modal * reordered tool params * update docs
1 parent df16382 commit 56ede1c

186 files changed

Lines changed: 4541 additions & 7824 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.github/CONTRIBUTING.md‎

Lines changed: 3 additions & 6 deletions

‎apps/docs/content/docs/tools/airtable.mdx‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,8 +151,6 @@ Update multiple existing records in an Airtable table
151151
| `baseId` | string | Yes | ID of the Airtable base |
152152
| `tableId` | string | Yes | ID or name of the table |
153153
| `records` | json | Yes | Array of records to update, each with an `id` and a `fields` object |
154-
| `fields` | string | No | No description |
155-
| `fields` | string | No | No description |
156154

157155
#### Output
158156

‎apps/docs/content/docs/tools/browser_use.mdx‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,10 @@ Runs a browser automation task using BrowserUse
8282

8383
| Parameter | Type | Description |
8484
| --------- | ---- | ----------- |
85-
| `success` | boolean | Operation success status |
86-
| `output` | json | Browser automation task results including task ID, success status, output data, and execution steps |
87-
| `error` | string | Error message if the operation failed |
85+
| `id` | string | Task execution identifier |
86+
| `success` | boolean | Task completion status |
87+
| `output` | json | Task output data |
88+
| `steps` | json | Execution steps taken |
8889

8990

9091

‎apps/docs/content/docs/tools/elevenlabs.mdx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ Convert TTS using ElevenLabs voices
6262

6363
| Parameter | Type | Description |
6464
| --------- | ---- | ----------- |
65-
| `audioUrl` | string | Generated audio URL |
65+
| `audioUrl` | string | The URL of the generated audio |
6666

6767

6868

‎apps/docs/content/docs/tools/file.mdx‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@ Parse one or more uploaded files or files from URLs (text, PDF, CSV, images, etc
7171

7272
| Parameter | Type | Description |
7373
| --------- | ---- | ----------- |
74-
| `files` | json | Array of parsed file objects with content, metadata, and file properties |
75-
| `combinedContent` | string | All file contents merged into a single text string |
74+
| `files` | array | Array of parsed files |
75+
| `combinedContent` | string | Combined content of all parsed files |
7676

7777

7878

‎apps/docs/content/docs/tools/supabase.mdx‎

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,8 @@ Query data from a Supabase table
101101

102102
| Parameter | Type | Description |
103103
| --------- | ---- | ----------- |
104-
| `success` | boolean | Operation success status |
105-
| `output` | object | Query operation results |
104+
| `message` | string | Operation status message |
105+
| `results` | array | Array of records returned from the query |
106106

107107
### `supabase_insert`
108108

@@ -121,8 +121,8 @@ Insert data into a Supabase table
121121

122122
| Parameter | Type | Description |
123123
| --------- | ---- | ----------- |
124-
| `success` | boolean | Operation success status |
125-
| `output` | object | Insert operation results |
124+
| `message` | string | Operation status message |
125+
| `results` | array | Array of inserted records |
126126

127127
### `supabase_get_row`
128128

@@ -141,8 +141,8 @@ Get a single row from a Supabase table based on filter criteria
141141

142142
| Parameter | Type | Description |
143143
| --------- | ---- | ----------- |
144-
| `success` | boolean | Operation success status |
145-
| `output` | object | Get row operation results |
144+
| `message` | string | Operation status message |
145+
| `results` | object | The row data if found, null if not found |
146146

147147
### `supabase_update`
148148

@@ -162,8 +162,8 @@ Update rows in a Supabase table based on filter criteria
162162

163163
| Parameter | Type | Description |
164164
| --------- | ---- | ----------- |
165-
| `success` | boolean | Operation success status |
166-
| `output` | object | Update operation results |
165+
| `message` | string | Operation status message |
166+
| `results` | array | Array of updated records |
167167

168168
### `supabase_delete`
169169

@@ -182,8 +182,8 @@ Delete rows from a Supabase table based on filter criteria
182182

183183
| Parameter | Type | Description |
184184
| --------- | ---- | ----------- |
185-
| `success` | boolean | Operation success status |
186-
| `output` | object | Delete operation results |
185+
| `message` | string | Operation status message |
186+
| `results` | array | Array of deleted records |
187187

188188

189189

‎apps/sim/app/api/proxy/route.ts‎

Lines changed: 2 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -235,42 +235,8 @@ export async function POST(request: Request) {
235235
error: result.error || 'Unknown error',
236236
})
237237

238-
if (tool.transformError) {
239-
try {
240-
const errorResult = tool.transformError(result)
241-
242-
// Handle both string and Promise return types
243-
if (typeof errorResult === 'string') {
244-
throw new Error(errorResult)
245-
}
246-
// It's a Promise, await it
247-
const transformedError = await errorResult
248-
// If it's a string or has an error property, use it
249-
if (typeof transformedError === 'string') {
250-
throw new Error(transformedError)
251-
}
252-
if (
253-
transformedError &&
254-
typeof transformedError === 'object' &&
255-
'error' in transformedError
256-
) {
257-
throw new Error(transformedError.error || 'Tool returned an error')
258-
}
259-
// Fallback
260-
throw new Error('Tool returned an error')
261-
} catch (transformError) {
262-
logger.error(`[${requestId}] Error transformation failed for ${toolId}`, {
263-
error:
264-
transformError instanceof Error ? transformError.message : String(transformError),
265-
})
266-
if (transformError instanceof Error) {
267-
throw transformError
268-
}
269-
throw new Error('Tool returned an error')
270-
}
271-
} else {
272-
throw new Error('Tool returned an error')
273-
}
238+
// Let the main executeTool handle error transformation to avoid double transformation
239+
throw new Error(result.error || 'Tool execution failed')
274240
}
275241

276242
const endTime = new Date()
Lines changed: 147 additions & 0 deletions

0 commit comments

Comments
 (0)