Skip to content

fix: inherit generated AnalyticsResource to expose MCP methods#14

Open
elean-latedev wants to merge 1 commit intodevelopfrom
fix/analytics-mcp-inheritance
Open

fix: inherit generated AnalyticsResource to expose MCP methods#14
elean-latedev wants to merge 1 commit intodevelopfrom
fix/analytics-mcp-inheritance

Conversation

@elean-latedev
Copy link

Summary

  • All 9 analytics MCP tools (get_analytics, get_daily_metrics, get_best_time_to_post, get_content_decay, get_posting_frequency, get_post_timeline, get_you_tube_daily_views, get_linked_in_aggregate_analytics, get_linked_in_post_analytics) failed with AttributeError: 'AnalyticsResource' object has no attribute 'get_analytics'
  • Root cause: manual AnalyticsResource (inheriting BaseResource[Any]) shadowed the generated class that has all 18 methods MCP tools expect
  • Fix: change parent class from BaseResource[Any] to the generated AnalyticsResource, exposing all generated methods via inheritance while preserving get()/get_usage() convenience aliases for existing SDK users

Test plan

  • AST verification: 25 total methods available (4 manual + 21 generated), zero overlaps
  • Import chain verified: client → __init__ → manual → generated (no circular imports)
  • _build_params compatibility confirmed (functionally identical implementations)
  • __init__ compatibility confirmed (identical signatures)
  • No isinstance(x, BaseResource) checks in tests
  • _BASE_PATH preserved for convenience methods, no conflict with generated class
  • 157 tests passed, 0 failures

🤖 Generated with Claude Code

All 9 analytics MCP tools failed with AttributeError because the manual
AnalyticsResource (used by the client) lacked the generated methods
(get_analytics, get_daily_metrics, etc.). Switching the parent class
from BaseResource[Any] to the generated AnalyticsResource exposes all
18 generated methods via inheritance while preserving the convenience
get()/get_usage() aliases for existing SDK users.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant