# Help with the tool arguments being sent

**URL:** <https://community.crewai.com/t/help-with-the-tool-arguments-being-sent/1075>\
**Category:** CrewAI Community Support\
**Tags:** openai, crewai\
**Created:** [October 28, 2024, 8:10am UTC](https://community.crewai.com/t/help-with-the-tool-arguments-being-sent/1075 "2024-10-28T08:10:19Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![avishwa23](https://avatars.discourse-cdn.com/v4/letter/a/7c8e57/32.png) [@avishwa23](https://community.crewai.com/u/avishwa23)\
**Post date:** [October 28, 2024, 8:10am UTC](https://community.crewai.com/t/help-with-the-tool-arguments-being-sent/1075/1 "2024-10-28T08:10:19Z")

</div>

Hi, I was running this [crewai example](https://github.com/crewAIInc/crewAI-examples/tree/main/trip_planner) with the latest version of crewai (`crewai==0.76.2`, `crewai-tools==0.13.2`, `langchain==0.3.4`) and I have internet searching function as a tool taking in a `query` argument (seen in the image below).

 ![image](https://us1.discourse-cdn.com/flex025/uploads/crewai/original/1X/b00f8031ea3b3d2f41bcf3021bedfe8b79a5179d.png)

The issue is that my LLM (OpenAI model (`gpt-4o-2024-08-06`)) is always returning argument as `name` instead of `query` in its response (e.g., `{` **name** `: 'ACTUAL_SEARCH_QUERY_FROM_LLM'}`). I am not sure if the LLM is misinterpreting the `name` argument in the `tool arguments` section (highlighted in the picture) as the function argument.

Can anyone help with (1) understanding **where this tool definition in the prompt is coming from** and (2) **how to resolve this error (to have llm output QUERY instead of NAME)**?  
Thanks.

---

<div class="post-metadata">

**Author:** ![zholti](https://sea1.discourse-cdn.com/flex025/user_avatar/community.crewai.com/zholti/32/907_2.png) [@zholti](https://community.crewai.com/u/zholti)\
**Post date:** [November 7, 2024, 12:06pm UTC](https://community.crewai.com/t/help-with-the-tool-arguments-being-sent/1075/2 "2024-11-07T12:06:32Z")

</div>

Experiencing the same issue with crewai==0.76.9, pydantic==2.10.0.b1.

---

<div class="post-metadata">

**Author:** ![zholti](https://sea1.discourse-cdn.com/flex025/user_avatar/community.crewai.com/zholti/32/907_2.png) [@zholti](https://community.crewai.com/u/zholti)\
**Post date:** [November 7, 2024, 1:22pm UTC](https://community.crewai.com/t/help-with-the-tool-arguments-being-sent/1075/3 "2024-11-07T13:22:44Z")

</div>

I believe that this behavior is a bug in the Agent class in `agent.py`, specifically in the `_render_text_description_and_args` function.

In this function, the input args for the tools are built from all fields on the Pydantic type, as opposed to the args\_schema fields only:

```auto
args_schema = str(tool.model_fields)

```

Instead, I’d gather the args like this:

```auto
args_schema = {key: val['type'] for key, val in tool.args.items()}

```

Am I missing something or can we fix this as described?

---

<div class="post-metadata">

**Author:** ![tonykipkemboi](https://sea1.discourse-cdn.com/flex025/user_avatar/community.crewai.com/tonykipkemboi/32/4070_2.png) [@tonykipkemboi](https://community.crewai.com/u/tonykipkemboi)\
**Post date:** [November 8, 2024, 5:19pm UTC](https://community.crewai.com/t/help-with-the-tool-arguments-being-sent/1075/4 "2024-11-08T17:19:09Z")

</div>

Hi @avishwa23,  
Are you running this example code?

 ![Screenshot 2024-11-08 at 12.17.56 PM](https://us1.discourse-cdn.com/flex025/uploads/crewai/original/1X/2dc212224d4b1c2e744517f487548ed5f0621dd8.png)

---

<div class="post-metadata">

**Author:** ![avishwa23](https://avatars.discourse-cdn.com/v4/letter/a/7c8e57/32.png) [@avishwa23](https://community.crewai.com/u/avishwa23)\
**Post date:** [November 9, 2024, 1:19am UTC](https://community.crewai.com/t/help-with-the-tool-arguments-being-sent/1075/5 "2024-11-09T01:19:10Z")

</div>

Hi @tonykipkemboi , almost similar, the only difference being the way I am setting the model. I am setting the model name as an environment variable using `OPENAI_MODEL_NAME` which I guess CrewAI looks for. I am using the latest gpt-4o.

And the crewAI library version (`0.76.2`) is the latest (as of writing the original thread) as well.

---

<div class="post-metadata">

**Author:** ![avishwa23](https://avatars.discourse-cdn.com/v4/letter/a/7c8e57/32.png) [@avishwa23](https://community.crewai.com/u/avishwa23)\
**Post date:** [November 9, 2024, 1:37am UTC](https://community.crewai.com/t/help-with-the-tool-arguments-being-sent/1075/6 "2024-11-09T01:37:50Z")

</div>

> [@zholti](#):
>
> Instead, I’d gather the args like this:

I think you are right…At least the `_render_text_description_and_args` method is expected to do so (based on its docstrings, seen below). Do you think its a minor bug in the code @tonykipkemboi ?  
Thanks.

 ![image](https://us1.discourse-cdn.com/flex025/uploads/crewai/original/1X/196810524e6c5c0115c0fdea08a7e9be10fb4994.png)
