Issue combining Retrieval tool (VertexRagStore) with custom function_declarations

Hi everyone,

I’m running into a problem when trying to use both the Retrieval tool (VertexRagStore) and custom function_declarations in the same Gemini API request.

  • If I use only retrieval, it works.
  • If I use only function declarations, it works.
  • But if I try to combine them, I immediately get this error:
{
  "error": {
    "code": 400,
    "message": "Request contains an invalid argument.",
    "status": "INVALID_ARGUMENT"
  }
}

I’ve double-checked my request JSON and schema definitions, and both tools work fine individually. The error only happens when they are passed together.

My question: Is combining VertexRagStore retrieval with function declarations currently supported in the Gemini API on Vertex AI?
If yes, what’s the correct way to structure the tools section so the request doesn’t fail?

Thanks in advance for any guidance or examples.

Hello,

Welcome to the Forum!

Could you please share relevant code so that we can analyze this issue internally before arriving at a solution?