Skip to content

[Tooling] Tools fail if defined without arguments #814

@Yorkemartin

Description

@Yorkemartin

Describe the bug

I have a simple tool that returns some data from a database. It does not need an argument. As a result of not having an argument, it fails in ways that are hard to debug.

When invoking the tool directly in the dev ui, it works appropriately.

However, when used in a flow. the tool (with no input schema) errors with:

INVALID_ARGUMENT: Schema validation failed. Parse Errors: - tools.2.inputSchema: must be object

with z.object({}), it errors in the flow and direct invocation with:

  • flow:
    [GoogleGenerativeAI Error]: Error fetching from https://generativelanguage.googleapis.com/v1beta/models/gemini-1.5-flash-latest:generateContent: [400 Bad Request] * GenerateContentRequest.tools[0].function_declarations[2].parameters.properties: should be non-empty for OBJECT type

  • tool:
    `TRPCClientError: INVALID_ARGUMENT: Schema validation failed. Parse Errors:

  • (root): must be object`

with z.any() the tool works, and returns a populated object, but the flow errors with

Cannot read properties of undefined (reading 'toUpperCase') TypeError: Cannot read properties of undefined (reading 'toUpperCase') at convertSchemaProperty (/Users/connor/fora-echo/node_modules/@genkit-ai/googleai/lib/gemini.js:234:78)

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • mac OS: 14.4 (23E214)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingtooling

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions