Skip to content

Conversation

@AdamGustavsson
Copy link

This fixes the failure in Codex CLI
As discussed in #40 . Tried it with Gemini CLI too and it works there too.

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants