* In server/src/index.ts
- add delete handler for /mcp endpoint
- gets the server transport for the sessionId
- calls terminateSession on it
- removes the webapp and server transports for the sessionId from the maps
- returns status 200 to the client.
* In client/src/lib/hooks/useConnection.ts
- import Transport
- add useState for clientTransport, type Transport or null initialized to null
- in connect() function
- move creation of client transport down a ways, just before calling client.connect with it
- immendiately efter calling client.connect, call setClientTransport with the connected transport (has to happen after, so that what's saved has the abort controller, etc. otherwise it doesn't work to save it prior.
- in disconnect() function
- immediately call clientTransport.terminateSession if transportType is "streamable-http"
- setClientTransport to null
- Extract tool results rendering into separate ToolResults component
- Hoist checkContentCompatibility function to module level following codebase conventions
- Add ajv@6.12.6 as direct dependency to client package.json
- All tests pass and linting is clean
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Remove unused catch parameter in ToolsTab.tsx
- Replace 'as any' with @ts-expect-error in test for invalid schema
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
The previous test implementation caused build failures due to Jest
hoisting issues with mock variables. This commit fixes the build by
removing mocking in favor of using real schema validation.
- Remove jest.mock() of schemaUtils module that caused initialization errors
- Add beforeEach to clear schema cache between tests
- Use cacheToolOutputSchemas() to set up test scenarios
- Let real validation logic run for more accurate tests
- All tests pass and build succeeds
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Applied consistent formatting to ToolsTab.tsx and schemaUtils.ts
to fix linting issues. No functional changes.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Added extensive test coverage for the new structured output features:
Schema Utilities Tests:
- Tests for cacheToolOutputSchemas function
- Tests for validateToolOutput with various scenarios
- Tests for getToolOutputValidator and hasOutputSchema helpers
- Coverage for valid/invalid schemas and edge cases
- Tests for nested object validation
ToolsTab Component Tests:
- Tests for output schema display and expand/collapse functionality
- Tests for structured content validation display
- Tests for validation error messages
- Tests for unstructured content title logic
- Tests for compatibility checking between structured/unstructured content
- Tests ensuring compatibility check only runs with output schemas
All tests passing with 100% coverage of new functionality.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
This commit adds comprehensive support for structured output validation in tool calls,
following the MCP specification for tools with output schemas.
UI Changes:
1. Output Schema Display:
- Added collapsible output schema section in ToolsTab
- Shows output schemas after input fields, before the Run Tool button
- Default view shows 8 lines with scrolling, expandable to full view
- Expand/Collapse button with chevron icons for better UX
2. Structured Content Display:
- New "Structured Content" section when tools return structuredContent
- Shows structured data in a formatted JSON view
- Validation status indicator (green checkmark for valid, red X for errors)
- Detailed validation error messages when content doesn't match schema
3. Unstructured Content Labeling:
- Added "Unstructured Content" heading when both structured and unstructured content exist
- Only shows label when structured content is also present
- Maintains clean UI when only unstructured content exists
4. Compatibility Checking:
- Checks if unstructured content matches structured content (when output schema exists)
- Shows compatibility status with blue (compatible) or yellow (incompatible) indicators
- Detailed messages explain why content doesn't match
- Only runs compatibility check for tools with output schemas
5. Validation Error Handling:
- Shows error when tool with output schema doesn't return structured content
- Clear error messages for schema validation failures
- Maintains proper error state display
Technical Implementation:
- Added schema validation utilities using Ajv (same as SDK)
- Caches compiled validators for performance
- Validates on tool result display, not during the call
- Follows SDK's Client.callTool validation pattern
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>