Skip to content

chore: Update ToolHive API models#282

Merged
aponcedeleonch merged 3 commits intomainfrom
update-thv-models-21270186729
Jan 23, 2026
Merged

chore: Update ToolHive API models#282
aponcedeleonch merged 3 commits intomainfrom
update-thv-models-21270186729

Conversation

@stackloke2e
Copy link
Contributor

Summary

This PR updates the ToolHive API models generated from the latest OpenAPI specification.

Changes

  • Updated Pydantic models in src/mcp_optimizer/toolhive/api_models/

Notes

  • This PR was automatically generated by the update-thv-models workflow
  • The models are generated using datamodel-codegen from ToolHive's OpenAPI endpoint

🤖 Generated with GitHub Actions

Automated update of ToolHive API models from OpenAPI specification.
@claude
Copy link

claude bot commented Jan 23, 2026

PR Review: ToolHive API Models Update

Summary

Auto-generated update to Pydantic models from ToolHive's OpenAPI spec. The changes modernize type annotations and add new enums.

Key Changes

Type Annotation Modernization: Replaced Optional[T] with T | None (PEP 604 style) - aligns with project preference for native Python types

New Enums Added: MCPClient, WorkloadStatus, ProxyMode, TransportType improve type safety

Field Aliases: Added camelCase aliases (e.g., eventTypes, logFile) for proper API serialization

New Fields:

  • auth.py: Added scopes field for OAuth configuration
  • core.py: Added started_at field and uses new enum types

Potential Issues

⚠️ Breaking Changes - Requires Testing:

  1. core.Workload.status: Changed from str | None to runtime.WorkloadStatus | None enum
  2. core.Workload.transport_type: Changed from str | None to types.TransportType | None enum
  3. client.RegisteredClient.name and client.MCPClientStatus.client_type: Changed to MCPClient enum
  4. Impact: Code checking these fields with string comparisons will break

Action Required: Search codebase for usage patterns like:

  • if workload.status == "running" (now needs runtime.WorkloadStatus.workload_status_running)
  • if workload.transport_type == "sse" (now needs types.TransportType.transport_type_sse)

⚠️ Verbosity: New enum names are verbose (WorkloadStatus.workload_status_running, TransportType.transport_type_sse) with redundant prefixes. This is code-generated but makes usage less ergonomic.

⚠️ Removed Models: authz.CedarConfig class was removed - verify not in use

Recommendations

  1. Urgent: Run full test suite to catch string-to-enum breaking changes
  2. Consider post-processing generated enums to remove redundant prefixes
  3. Verify all imports work with new cross-module dependencies (core.py now imports runtime and types)

Test Command: uv run pytest -xvs to catch any runtime issues

Verdict

✅ Approve pending successful CI checks - but monitor for runtime errors related to enum conversions.

Copy link
Contributor

@therealnb therealnb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like it

@aponcedeleonch aponcedeleonch merged commit cab6a9a into main Jan 23, 2026
6 checks passed
@aponcedeleonch aponcedeleonch deleted the update-thv-models-21270186729 branch January 23, 2026 10:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants