Skip to content

Commit 7e46608

Browse files
authored
feat!: embed hints in tool descriptions (#18)
BREAKING CHANGE: removes all of the `*_hints` MCP tools and instead moves hints to the dynamically generated `description` for the `run_report` and `run_realtime_report` tools.
1 parent 7ee2f51 commit 7e46608

9 files changed

Lines changed: 615 additions & 408 deletions

File tree

README.md

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -23,29 +23,14 @@ to provide several
2323

2424
### Run core reports :orange_book:
2525

26-
- `run_report`: Run a Google Analytics report using the Data API.
27-
- `get_dimensions`: Retrieves Core Reporting Dimensions for a specific
28-
property, including its custom dimensions.
29-
- `get_metrics`: Retrieves Core Reporting Metrics for a specific property,
30-
including its custom dimensions.
31-
- `get_standard_dimensions`: Returns a list of standard dimensions.
32-
- `get_standard_metrics`: Returns a list of standard metrics.
33-
- `run_report_date_ranges_hints`: Provides hints about the expected values
34-
for the `date_ranges` argument for the `run_report` tool.
35-
- `run_report_metric_filter_hints`: Provides hints about the expected values
36-
for the metric_filter argument for the `run_report` and
37-
`run_realtime_report` tools.
38-
- `run_report_dimension_filter_hints`: Provides hints about the expected
39-
values for the dimension_filter argument for the `run_report` and
40-
`run_realtime_report` tools.
26+
- `run_report`: Runs a Google Analytics report using the Data API.
27+
- `get_custom_dimensions_and_metrics`: Retrieves the custom dimensions and
28+
metrics for a specific property.
4129

4230
### Run realtime reports :hourglass_flowing_sand:
4331

44-
- `run_realtime_report`: Run a Google Analytics realtime report using the
32+
- `run_realtime_report`: Runs a Google Analytics realtime report using the
4533
Data API.
46-
- `get_realtime_dimensions`: Retrieves the list of realtime reporting
47-
dimensions.
48-
- `get_realtime_metrics`: Retrieves the list of realtime metrics.
4934

5035
## Setup instructions
5136

analytics_mcp/tools/admin/info.py

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
from analytics_mcp.coordinator import mcp
2020
from analytics_mcp.tools.utils import (
21+
construct_property_rn,
2122
create_admin_api_client,
2223
proto_to_dict,
2324
)
@@ -38,15 +39,16 @@ async def get_account_summaries() -> List[Dict[str, Any]]:
3839

3940

4041
@mcp.tool(title="List links to Google Ads accounts")
41-
async def list_google_ads_links(property_id: str) -> List[Dict[str, Any]]:
42+
async def list_google_ads_links(property_id: int | str) -> List[Dict[str, Any]]:
4243
"""Returns a list of links to Google Ads accounts for a property.
4344
4445
Args:
45-
property_id: The ID of the property.
46+
property_id: The Google Analytics property ID. Accepted formats are:
47+
- A number
48+
- A string consisting of 'properties/' followed by a number
4649
"""
47-
property_resource_name = f"properties/{property_id}"
4850
request = admin_v1beta.ListGoogleAdsLinksRequest(
49-
parent=property_resource_name
51+
parent=construct_property_rn(property_id)
5052
)
5153
# Uses an async list comprehension so the pager returned by
5254
# list_google_ads_links retrieves all pages.
@@ -58,13 +60,16 @@ async def list_google_ads_links(property_id: str) -> List[Dict[str, Any]]:
5860

5961

6062
@mcp.tool(title="Gets details about a property")
61-
def get_property_details(property_id: str) -> Dict[str, Any]:
63+
def get_property_details(property_id: int | str) -> Dict[str, Any]:
6264
"""Returns details about a property.
6365
Args:
64-
property_id: The ID of the property.
66+
property_id: The Google Analytics property ID. Accepted formats are:
67+
- A number
68+
- A string consisting of 'properties/' followed by a number
6569
"""
6670
client = admin_v1beta.AnalyticsAdminServiceClient()
67-
property_resource_name = f"properties/{property_id}"
68-
request = admin_v1beta.GetPropertyRequest(name=property_resource_name)
71+
request = admin_v1beta.GetPropertyRequest(
72+
name=construct_property_rn(property_id)
73+
)
6974
response = client.get_property(request=request)
7075
return proto_to_dict(response)

0 commit comments

Comments
 (0)