mirror of
https://github.com/twentyhq/twenty
synced 2026-04-21 13:37:22 +00:00
fix(server): guard against undefined args in stripLoadingMessage and resolveAndExecute
https://sonarly.com/issue/28820?type=bug The MCP tool execution chain crashes with a TypeError when `execute_tool` is called without an inner `arguments` field, because `stripLoadingMessage` destructures an undefined parameter. A secondary i18n issue causes log spam from uncompiled Lingui message catalogs. Fix: Applied above. Two minimal defensive defaults preventing undefined from reaching destructure operations.
This commit is contained in:
parent
75848ff8ea
commit
1f05071d72
2 changed files with 5 additions and 1 deletions
|
|
@ -54,7 +54,7 @@ export const createExecuteToolTool = (
|
|||
parameters: ExecuteToolInput,
|
||||
options: ToolExecutionOptions,
|
||||
): Promise<ToolOutput> => {
|
||||
const { toolName, arguments: args } = parameters;
|
||||
const { toolName, arguments: args = {} } = parameters;
|
||||
|
||||
if (excludeTools?.has(toolName)) {
|
||||
return {
|
||||
|
|
|
|||
|
|
@ -42,6 +42,10 @@ export const wrapJsonSchemaForExecution = (
|
|||
export const stripLoadingMessage = <T extends Record<string, unknown>>(
|
||||
parameters: T,
|
||||
): Omit<T, 'loadingMessage'> => {
|
||||
if (!parameters) {
|
||||
return {} as Omit<T, 'loadingMessage'>;
|
||||
}
|
||||
|
||||
const { loadingMessage: _, ...rest } = parameters;
|
||||
|
||||
return rest;
|
||||
|
|
|
|||
Loading…
Reference in a new issue