Adjust run_report date range schema that caused failure in Codex CLI#67
Adjust run_report date range schema that caused failure in Codex CLI#67AdamGustavsson wants to merge 1 commit intogoogleanalytics:mainfrom
Conversation
| async def run_report( | ||
| property_id: int | str, | ||
| date_ranges: List[Dict[str, str]], | ||
| date_ranges: List[Dict[str, Any]], |
There was a problem hiding this comment.
I'm a bit confused as to why this fixes the error "invalid type: map, expected a boolean", given:
- There are no booleans involved here.
- 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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
"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.
There was a problem hiding this comment.
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?
This fixes the failure in Codex CLI
As discussed in #40 . Tried it with Gemini CLI too and it works there too.