Skip to content

Commit 3d81c1c

Browse files
committed
revert
1 parent 94c6795 commit 3d81c1c

File tree

4 files changed

+5
-57
lines changed

4 files changed

+5
-57
lines changed

apps/sim/tools/index.ts

Lines changed: 1 addition & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -43,58 +43,6 @@ function normalizeToolId(toolId: string): string {
4343
*/
4444
const MAX_REQUEST_BODY_SIZE_BYTES = 10 * 1024 * 1024 // 10MB
4545

46-
/**
47-
* Parameter aliases that LLMs commonly use as synonyms.
48-
* Maps alternative parameter names to their canonical names.
49-
* Key: toolId, Value: map of alias -> canonical parameter name
50-
*/
51-
const PARAMETER_ALIASES: Record<string, Record<string, string>> = {
52-
table_update_row: {
53-
values: 'data',
54-
row: 'data',
55-
fields: 'data',
56-
update: 'data',
57-
updates: 'data',
58-
changes: 'data',
59-
newData: 'data',
60-
rowData: 'data',
61-
},
62-
table_insert_row: {
63-
values: 'data',
64-
row: 'data',
65-
fields: 'data',
66-
rowData: 'data',
67-
},
68-
table_upsert_row: {
69-
values: 'data',
70-
row: 'data',
71-
fields: 'data',
72-
rowData: 'data',
73-
},
74-
}
75-
76-
/**
77-
* Applies parameter aliases to normalize LLM-provided parameters.
78-
* If the LLM uses an alias (e.g., "values" instead of "data"),
79-
* this function maps it to the canonical parameter name.
80-
*/
81-
function applyParameterAliases(toolId: string, params: Record<string, any>): Record<string, any> {
82-
const aliases = PARAMETER_ALIASES[toolId]
83-
if (!aliases) return params
84-
85-
const normalizedParams = { ...params }
86-
87-
for (const [alias, canonical] of Object.entries(aliases)) {
88-
// If the alias is present and the canonical name is not, copy the value
89-
if (alias in normalizedParams && !(canonical in normalizedParams)) {
90-
normalizedParams[canonical] = normalizedParams[alias]
91-
delete normalizedParams[alias]
92-
}
93-
}
94-
95-
return normalizedParams
96-
}
97-
9846
/**
9947
* User-friendly error message for body size limit exceeded
10048
*/
@@ -287,8 +235,7 @@ export async function executeTool(
287235
}
288236

289237
// Ensure context is preserved if it exists
290-
// Apply parameter aliases to handle common LLM synonym usage (e.g., "values" -> "data")
291-
const contextParams = applyParameterAliases(normalizedToolId, { ...params })
238+
const contextParams = { ...params }
292239

293240
// Validate the tool and its parameters
294241
validateRequiredParametersAfterMerge(toolId, tool, contextParams)

apps/sim/tools/table/insert-row.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ import type { TableRowInsertParams, TableRowResponse } from './types'
44
export const tableInsertRowTool: ToolConfig<TableRowInsertParams, TableRowResponse> = {
55
id: 'table_insert_row',
66
name: 'Insert Row',
7-
description: 'Insert a new row into a table',
7+
description:
8+
'Insert a new row into a table. IMPORTANT: You must use the "data" parameter (not "values", "row", "fields", or other variations) to specify the row contents.',
89
version: '1.0.0',
910

1011
params: {

apps/sim/tools/table/update-row.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export const tableUpdateRowTool: ToolConfig<TableRowUpdateParams, TableRowRespon
55
id: 'table_update_row',
66
name: 'Update Row',
77
description:
8-
'Update an existing row in a table. Supports partial updates - only include the fields you want to change.',
8+
'Update an existing row in a table. Supports partial updates - only include the fields you want to change. IMPORTANT: You must use the "data" parameter (not "values", "row", "fields", or other variations) to specify the fields to update.',
99
version: '1.0.0',
1010

1111
params: {

apps/sim/tools/table/upsert-row.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export const tableUpsertRowTool: ToolConfig<TableRowInsertParams, TableUpsertRes
1414
id: 'table_upsert_row',
1515
name: 'Upsert Row',
1616
description:
17-
'Insert or update a row based on unique column constraints. If a row with matching unique field exists, update it; otherwise insert a new row.',
17+
'Insert or update a row based on unique column constraints. If a row with matching unique field exists, update it; otherwise insert a new row. IMPORTANT: You must use the "data" parameter (not "values", "row", "fields", or other variations) to specify the row contents.',
1818
version: '1.0.0',
1919

2020
params: {

0 commit comments

Comments
 (0)