Skip to content

Commit 80f3408

Browse files
committed
Update toolWithSampleServer.ts
1 parent ae7ad85 commit 80f3408

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/examples/server/toolWithSampleServer.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,12 @@ mcpServer.registerTool(
3333
maxTokens: 500
3434
});
3535

36+
const contents = Array.isArray(response.content) ? response.content : [response.content];
3637
return {
37-
content: [
38-
{
39-
type: 'text',
40-
text: response.content.type === 'text' ? response.content.text : 'Unable to generate summary'
41-
}
42-
]
38+
content: contents.map(content => ({
39+
type: 'text',
40+
text: content.type === 'text' ? content.text : 'Unable to generate summary'
41+
}))
4342
};
4443
}
4544
);

0 commit comments

Comments
 (0)