restore server-side validation for tools returning structuredContent without outputSchema

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Basil Hosmer 2025-05-15 09:57:20 -04:00
commit 39b2f65434
No known key found for this signature in database

View file

@ -226,6 +226,14 @@ export class McpServer {
`Tool ${request.params.name} has no outputSchema and must return content`,
);
}
// If structuredContent is provided, it's an error
if (result.structuredContent) {
throw new McpError(
ErrorCode.InternalError,
`Tool ${request.params.name} has no outputSchema but returned structuredContent`,
);
}
}
return result;