feat: add read-only discovery and admin tools (9 tools)#178
Open
Avicennasis wants to merge 9 commits into
Open
feat: add read-only discovery and admin tools (9 tools)#178Avicennasis wants to merge 9 commits into
Avicennasis wants to merge 9 commits into
Conversation
Lists the key events (conversions) configured for a GA4 property via the Admin API properties.keyEvents.list method. Read-only; fits the existing analytics.readonly scope.
Lists the data streams (web, Android, iOS) configured for a GA4 property via the Admin API properties.dataStreams.list method, including platform-specific details such as web measurement IDs. Read-only; fits the existing analytics.readonly scope.
Exposes the complete properties.getMetadata response — standard and custom dimensions and metrics with descriptions, categories, and deprecation status — so an LLM can discover available fields before building a report. The existing get_custom_dimensions_and_metrics tool is unchanged and still returns only custom definitions.
Lists the GA4 properties under an account via the Admin API properties.list method with a parent account filter. Returns full property objects (display name, industry, time zone, currency, service level), complementing the summary info available from get_account_summaries. Adds a construct_account_rn helper to utils mirroring construct_property_rn.
Lists custom dimensions and metrics via the Admin API, which returns richer detail than the Data API metadata endpoint: scope, parameter name, description, measurement unit, and ads personalization / restricted metric flags. Read-only; fits the existing analytics.readonly scope.
Runs a data access report via the Admin API runAccessReport method, showing who accessed Analytics data, when, and how. Supports both property-level and account-level entities. Read-only; the method accepts the analytics.readonly scope.
Retrieves a property's data retention settings via the Admin API, showing how long event-level and user-level data is kept. Helps answer compliance questions and explains why older data may be missing from reports. Read-only; fits the existing analytics.readonly scope.
Lists the audiences defined on a GA4 property via the Admin API alpha channel, following the same pattern as the existing list_property_annotations tool. Read-only; fits the existing analytics.readonly scope.
Retrieves the current Data API quota snapshot for a property via the alpha getPropertyQuotasSnapshot method, so callers can check token consumption before running expensive batches and back off intelligently. Read-only; fits the existing analytics.readonly scope.
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
Adds nine read-only tools that close common discovery gaps when an LLM works with a GA4 property. All tools follow the existing patterns in
tools/admin/info.pyandtools/reporting/metadata.py, use the already-wired client factories fromtools/client.py, and fit the existinganalytics.readonlyscope (verified per method against the API reference).One commit per tool for easy review:
list_key_eventsproperties.keyEvents.listlist_data_streamsproperties.dataStreams.listget_metadataproperties.getMetadataget_custom_dimensions_and_metricsis unchanged and still returns the custom-only subset)list_propertiesproperties.listget_account_summarieslist_custom_dimensions/list_custom_metricsrun_access_reportrunAccessReportget_data_retention_settingslist_audiencesproperties.audiences.listlist_property_annotations)get_property_quotasgetPropertyQuotasSnapshotAlso adds a
construct_account_rnhelper toutils.py, mirroringconstruct_property_rn, for the account-scoped tools.Testing
tests/info_test.py,tests/metadata_test.py,tests/access_test.py,tests/quotas_test.py, plusconstruct_account_rncoverage intests/utils_test.pynox -s lint(black -l 80) clean; full unittest suite passes (31 tests)Happy to split this into smaller PRs if preferred — each commit stands alone.