Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion analytics_mcp/tools/reporting/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def _run_report_description() -> str:

async def run_report(
property_id: int | str,
date_ranges: List[Dict[str, str]],
date_ranges: List[Dict[str, Any]],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a bit confused as to why this fixes the error "invalid type: map, expected a boolean", given:

  1. There are no booleans involved here.
  2. The DateRange type is a Dict[str,str], per the spec at https://developers.google.com/analytics/devguides/reporting/data/v1/rest/v1beta/DateRange.

I see that this fixed #40 for you, but I'm not 100% clear as to why that is.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I was very confused too.
But Codex converts MCP tools to OpenAI tools and its in that conversion there is an exception.
ERROR codex_core::openai_tools: Failed to convert "analytics-mcp__run_report" MCP tool to OpenAI tool: Error("invalid type: map, expected a boolean", line: 0, column: 0).
The additionalProperties is causing the actual issue. OpenAI expects the type to be boolean.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"date_ranges": {
"items": {
"additionalProperties": {
"type": "string"
},
"type": "object"
}

the additionalProperties is a map in the input_schema and that is what fails when converting to an OpenAI tool.
Setting it to any in date_ranges: List[Dict[str, Any]], probably alters the rendered input schema so that there is no longer an exception when codex converts the tool.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this is a bug on Codex side then perhaps its best fixed there but I don't think this change has any side effects?

dimensions: List[str],
metrics: List[str],
dimension_filter: Dict[str, Any] = None,
Expand Down