Skip to content

Commit cc207e0

Browse files
ochafikclaude
andcommitted
fix(test): add content: [] to CallToolResult returns in client tests
Tests returning structuredContent without content were failing type checks since CallToolResult requires the content field. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent f4a6270 commit cc207e0

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

test/client/index.test.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1838,6 +1838,7 @@ describe('outputSchema validation', () => {
18381838
server.setRequestHandler(CallToolRequestSchema, async request => {
18391839
if (request.params.name === 'test-tool') {
18401840
return {
1841+
content: [],
18411842
structuredContent: { result: 'success', count: 42 }
18421843
};
18431844
}
@@ -1931,6 +1932,7 @@ describe('outputSchema validation', () => {
19311932
if (request.params.name === 'test-tool') {
19321933
// Return invalid structured content (count is string instead of number)
19331934
return {
1935+
content: [],
19341936
structuredContent: { result: 'success', count: 'not a number' }
19351937
};
19361938
}
@@ -2212,6 +2214,7 @@ describe('outputSchema validation', () => {
22122214
server.setRequestHandler(CallToolRequestSchema, async request => {
22132215
if (request.params.name === 'complex-tool') {
22142216
return {
2217+
content: [],
22152218
structuredContent: {
22162219
name: 'John Doe',
22172220
age: 30,
@@ -2315,6 +2318,7 @@ describe('outputSchema validation', () => {
23152318
if (request.params.name === 'strict-tool') {
23162319
// Return structured content with extra property
23172320
return {
2321+
content: [],
23182322
structuredContent: {
23192323
name: 'John',
23202324
extraField: 'not allowed'
@@ -3683,6 +3687,7 @@ test('callToolStream() should yield error when structuredContent does not match
36833687
server.setRequestHandler(CallToolRequestSchema, async () => {
36843688
// Return invalid structured content (count is string instead of number)
36853689
return {
3690+
content: [],
36863691
structuredContent: { result: 'success', count: 'not a number' }
36873692
};
36883693
});
@@ -3908,6 +3913,7 @@ test('callToolStream() should handle complex JSON schema validation', async () =
39083913

39093914
server.setRequestHandler(CallToolRequestSchema, async () => {
39103915
return {
3916+
content: [],
39113917
structuredContent: {
39123918
name: 'John Doe',
39133919
age: 30,
@@ -3992,6 +3998,7 @@ test('callToolStream() should yield error with additional properties when not al
39923998

39933999
server.setRequestHandler(CallToolRequestSchema, async () => {
39944000
return {
4001+
content: [],
39954002
structuredContent: {
39964003
name: 'John',
39974004
extraField: 'not allowed'

0 commit comments

Comments
 (0)