diff --git a/src/tools/dtos/tool-update.ts b/src/tools/dtos/tool-update.ts index b029934..c4f9070 100644 --- a/src/tools/dtos/tool-update.ts +++ b/src/tools/dtos/tool-update.ts @@ -54,7 +54,8 @@ export const toolUpdateBodySchema = { type: 'string' }, api_key: { - type: 'string' + type: 'string', + nullable: true }, metadata: metadataSchema, user_description: { type: 'string' } diff --git a/src/tools/tools.service.ts b/src/tools/tools.service.ts index b005181..7dd2673 100644 --- a/src/tools/tools.service.ts +++ b/src/tools/tools.service.ts @@ -848,7 +848,7 @@ export async function updateTool({ code: APIErrorCode.INVALID_INPUT }); } - tool.apiKey = getUpdatedValue(body.api_key, tool.apiKey); + tool.apiKey = getUpdatedValue(body.api_key && encrypt(body.api_key), tool.apiKey); } if ('parameters' in body) {