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
2 changes: 1 addition & 1 deletion client/src/components/ToolResults.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ const ToolResults = ({
error:
"Tool has an output schema but did not return structured content",
};
} else if (structuredResult.structuredContent) {
} else if (structuredResult.structuredContent && !isError) {
validationResult = validateToolOutput(
selectedTool.name,
structuredResult.structuredContent,
Expand Down
26 changes: 26 additions & 0 deletions client/src/components/__tests__/ToolsTab.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -483,6 +483,32 @@ describe("ToolsTab", () => {
).toBeInTheDocument();
});

it("should not validate structuredContent against output schema when isError is true", () => {
const errorResult = {
content: [
{
type: "text",
text: "Something went wrong",
},
],
structuredContent: {
errorCode: "NOT_FOUND",
},
isError: true,
};

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

// Should display structured content
expect(screen.getByText("Structured Content:")).toBeInTheDocument();
// Should NOT show a validation error
expect(screen.queryByText(/Validation Error:/)).not.toBeInTheDocument();
});

it("should show unstructured content title when both structured and unstructured exist", () => {
const resultWithBoth = {
content: [{ type: "text", text: '{"temperature": 25}' }],
Expand Down