Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion client/src/components/ToolResults.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ const ToolResults = ({
const toolHasOutputSchema =
selectedTool && hasOutputSchema(selectedTool.name);

if (toolHasOutputSchema) {
if (toolHasOutputSchema && !isError) {
if (!structuredResult.structuredContent && !isError) {
validationResult = {
isValid: false,
Expand All @@ -125,6 +125,7 @@ const ToolResults = ({

let compatibilityResult = null;
if (
!isError &&
structuredResult.structuredContent &&
structuredResult.content.length > 0 &&
selectedTool &&
Expand Down
21 changes: 21 additions & 0 deletions client/src/components/__tests__/ToolsTab.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,27 @@ describe("ToolsTab", () => {
expect(screen.getByText(/Validation Error:/)).toBeInTheDocument();
});

it("should skip output schema validation when tool result is an error", () => {
const errorResult = {
content: [{ type: "text", text: "error" }],
structuredContent: {
// Missing required field on purpose
},
isError: true,
};

renderToolsTab({
tools: [toolWithOutputSchema],
selectedTool: toolWithOutputSchema,
toolResult: errorResult,
});

expect(screen.queryByText(/Validation Error:/)).not.toBeInTheDocument();
expect(
screen.queryByText(/Valid according to output schema/),
).not.toBeInTheDocument();
});

it("should show error when tool with output schema doesn't return structured content", () => {
const resultWithoutStructured = {
content: [{ type: "text", text: "some result" }],
Expand Down