feat: typed MCP returns, async MCP client, error parity, forward-compat models#20
Merged
Merged
Conversation
…at models MCP client now returns Pydantic models instead of raw dicts, matching the REST client's contract. Models updated to match verified API shapes. Typed returns: - All 16 MCP methods return Pydantic models (StatusSummary, MttrReport, MonitorAnomaly, OutageTimeline, TeamMember, etc.) - New models: TimeGroup, ResponseTimeReport, AlertHistory, MttrReport, MttaReport, MonitorMetricsSummary, ProbeLogResponse, TeamMember, OutageMonitorSummary - OutageTimeline.outage is now typed Outage, .monitor is OutageMonitorSummary Async MCP client: - AsyncMcpTransport with httpx.AsyncClient, asyncio.Lock, async retry - AsyncHyperpingMcpClient with identical API to sync version Error handling parity: - Both sync and async MCP transports map 404, 429, 400/422 to the same exception types as the REST client - Retry with exponential backoff on 500/502/503/504 Forward compatibility: - All response models changed from extra="ignore" to extra="allow" - New API fields are preserved instead of silently dropped Thread safety: - threading.Lock (sync) and asyncio.Lock (async) on request ID counter and initialization flag
Add 83 new tests across 5 test files. Every source file is now at 87% or above (lowest: 88%). Overall coverage: 94% -> 96%. New test files: - test_async_mcp_transport.py (19 tests): full async transport coverage - test_client_coverage.py (20 tests): client retry, ping, repr, errors Extended test files: - test_mcp_transport.py (+11 tests): 404, 429, 400/422, retry exhaustion - test_async_preexisting.py (+13 tests): async maintenance and outage ops - test_sdk_surface.py (+5 tests): protocol bases, model deprecation aliases - test_outages.py (+8 tests): sync unacknowledge, delete, create, get
899b55c to
b26f8e3
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Upgrades the MCP client from returning raw dicts to returning typed Pydantic models, matching the REST client's contract. Adds async MCP client, error handling parity, retry logic, and forward-compatible models.
Typed returns
Any)TimeGroup,ResponseTimeReport,AlertHistory,MttrReport,MttaReport,MonitorMetricsSummary,ProbeLogResponse,TeamMember,OutageMonitorSummaryOutageTimeline.outageis typedOutage,.monitorisOutageMonitorSummary(wasdict[str, Any])Async MCP client
AsyncMcpTransportwithhttpx.AsyncClient,asyncio.Lock, async retryAsyncHyperpingMcpClientwith identical method signatures and return types as syncError handling parity
Forward compatibility
extra="ignore"toextra="allow"Thread safety
threading.Lock(sync) andasyncio.Lock(async) on request ID counter and init flagTest plan
OutageTimeline.outage.uuid,.monitor.nametyped access worksHyperpingAuthError