fix: inherit generated AnalyticsResource to expose MCP methods#14
Open
elean-latedev wants to merge 1 commit intodevelopfrom
Open
fix: inherit generated AnalyticsResource to expose MCP methods#14elean-latedev wants to merge 1 commit intodevelopfrom
elean-latedev wants to merge 1 commit intodevelopfrom
Conversation
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>
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
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 withAttributeError: 'AnalyticsResource' object has no attribute 'get_analytics'AnalyticsResource(inheritingBaseResource[Any]) shadowed the generated class that has all 18 methods MCP tools expectBaseResource[Any]to the generatedAnalyticsResource, exposing all generated methods via inheritance while preservingget()/get_usage()convenience aliases for existing SDK usersTest plan
__init__→ manual → generated (no circular imports)_build_paramscompatibility confirmed (functionally identical implementations)__init__compatibility confirmed (identical signatures)isinstance(x, BaseResource)checks in tests_BASE_PATHpreserved for convenience methods, no conflict with generated class🤖 Generated with Claude Code