Skip to content

Commit 507c514

Browse files
committed
oneliner for ifs
1 parent df8c23c commit 507c514

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

packages/core/src/integrations/mcp-server/attributeExtraction.ts

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -393,9 +393,7 @@ export function extractPromptResultAttributes(result: unknown): Record<string, s
393393

394394
const resultObj = result as Record<string, unknown>;
395395

396-
if (typeof resultObj.description === 'string') {
397-
attributes[MCP_PROMPT_RESULT_DESCRIPTION_ATTRIBUTE] = resultObj.description;
398-
}
396+
if (typeof resultObj.description === 'string') attributes[MCP_PROMPT_RESULT_DESCRIPTION_ATTRIBUTE] = resultObj.description;
399397

400398
if (Array.isArray(resultObj.messages)) {
401399
attributes[MCP_PROMPT_RESULT_MESSAGE_COUNT_ATTRIBUTE] = resultObj.messages.length;
@@ -405,15 +403,11 @@ export function extractPromptResultAttributes(result: unknown): Record<string, s
405403
if (typeof message === 'object' && message !== null) {
406404
const messageObj = message as Record<string, unknown>;
407405

408-
if (typeof messageObj.role === 'string') {
409-
attributes[MCP_PROMPT_RESULT_MESSAGE_ROLE_ATTRIBUTE] = messageObj.role;
410-
}
406+
if (typeof messageObj.role === 'string') attributes[MCP_PROMPT_RESULT_MESSAGE_ROLE_ATTRIBUTE] = messageObj.role;
411407

412408
if (typeof messageObj.content === 'object' && messageObj.content !== null) {
413409
const content = messageObj.content as Record<string, unknown>;
414-
if (typeof content.text === 'string') {
415-
attributes[MCP_PROMPT_RESULT_MESSAGE_CONTENT_ATTRIBUTE] = content.text;
416-
}
410+
if (typeof content.text === 'string') attributes[MCP_PROMPT_RESULT_MESSAGE_CONTENT_ATTRIBUTE] = content.text;
417411
}
418412
}
419413
}

0 commit comments

Comments
 (0)