# Issue combining Retrieval tool (VertexRagStore) with custom function\_declarations

**URL:** <https://discuss.ai.google.dev/t/issue-combining-retrieval-tool-vertexragstore-with-custom-function-declarations/102702>\
**Category:** Gemini API\
**Tags:** gemini-api, vertex-ai\
**Created:** [September 6, 2025, 8:39pm UTC](https://discuss.ai.google.dev/t/issue-combining-retrieval-tool-vertexragstore-with-custom-function-declarations/102702 "2025-09-06T20:39:44Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Baccari\_Ala](https://d1dlmcr85iqnpo.cloudfront.net/user_avatar/discuss.ai.google.dev/baccari_ala/32/63457_2.png) [@Baccari\_Ala](https://discuss.ai.google.dev/u/Baccari_Ala)\
**Post date:** [September 6, 2025, 8:39pm UTC](https://discuss.ai.google.dev/t/issue-combining-retrieval-tool-vertexragstore-with-custom-function-declarations/102702/1 "2025-09-06T20:39:44Z")

</div>

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:

```auto
{
  "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.

---

<div class="post-metadata">

**Author:** ![Lalit\_Kumar](https://d1dlmcr85iqnpo.cloudfront.net/user_avatar/discuss.ai.google.dev/lalit_kumar/32/37058_2.png) [@Lalit\_Kumar](https://discuss.ai.google.dev/u/Lalit_Kumar)\
**Post date:** [September 17, 2025, 6:27am UTC](https://discuss.ai.google.dev/t/issue-combining-retrieval-tool-vertexragstore-with-custom-function-declarations/102702/3 "2025-09-17T06:27:09Z")

</div>

Hello,

Welcome to the Forum!

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