Skip to content

Recursively remove additionalProperties for Gemini tools#682

Merged
pushpak1300 merged 2 commits into
laravel:0.xfrom
Edward144:fix/recursively-remove-gemini-additionalproperties
Jun 4, 2026
Merged

Recursively remove additionalProperties for Gemini tools#682
pushpak1300 merged 2 commits into
laravel:0.xfrom
Edward144:fix/recursively-remove-gemini-additionalproperties

Conversation

@Edward144
Copy link
Copy Markdown
Contributor

Similar to the issue highlighted in #139. Tools containing nested schema objects used by Gemini throw an error for additionalProperties.

"code": 400,
"message": "Invalid JSON payload received. Unknown name \"additionalProperties\"" 

For example in a tool such as:

class ExampleTool implements Tool
{
    public function description(): Stringable|string
    {
        return '';
    }

    public function handle(Request $request): Stringable|string
    {
        return '';
    } 

    public function schema(JsonSchema): array
    {
        return [
            'array' => $schema->array()
                ->items($schema->object([
                    'name' => $schema->string()->required(),
                    'description' => $schema->string()->required(),
                ]))
                ->required(),
        ];
    }
}

To fix this I have updated the MapsTools concern to recursively remove the key from the schema.

@jrking4
Copy link
Copy Markdown

jrking4 commented Jun 3, 2026

this fixes an issue i am having as well with Gemini tools

@pushpak1300 pushpak1300 merged commit 97e7997 into laravel:0.x Jun 4, 2026
2 of 7 checks passed
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.

3 participants