# ValidationError: Input should be a valid dictionary or instance of BaseTool

**URL:** <https://community.crewai.com/t/validationerror-input-should-be-a-valid-dictionary-or-instance-of-basetool/1718>\
**Category:** CrewAI Community Support\
**Tags:** agent, crewai\
**Created:** [November 29, 2024, 1:57pm UTC](https://community.crewai.com/t/validationerror-input-should-be-a-valid-dictionary-or-instance-of-basetool/1718 "2024-11-29T13:57:22Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![rokbenko](https://sea1.discourse-cdn.com/flex025/user_avatar/community.crewai.com/rokbenko/32/492_2.png) [@rokbenko](https://community.crewai.com/u/rokbenko)\
**Post date:** [November 29, 2024, 2:53pm UTC](https://community.crewai.com/t/validationerror-input-should-be-a-valid-dictionary-or-instance-of-basetool/1718/6 "2024-11-29T14:53:46Z")

</div>

> [@josh-lane](#):
>
> `search = DuckDuckGoSearchRun()`

You’re still initializing the tool without extending the `BaseTool` class by defining a subclass. Remove this line completely.

> [@josh-lane](#):
>
> `tools=[search]`

You’re still setting the `tool` parameter incorrectly.

> [@josh-lane](#):
>
> ```auto
> class MyCustomTool(BaseTool):
> name: str = "Name of my tool"
> description: str = "Clear description for what this tool is useful for, your agent will need this information to use it."
> 
> def _run(self, argument: str) -> str:
> # Implement DuckDuckGoSearchRun here
> 
> return "Result from custom tool"
> 
> ```

Also, you didn’t implement the tool. You just copy-pasted my code from the answer above.

Try the following:

```
from crewai.tools import BaseTool
from langchain_community.tools import DuckDuckGoSearchRun

class MyCustomDuckDuckGoTool(BaseTool):
    name: str = "DuckDuckGo Search Tool"
    description: str = "Search the web for a given query."

    def _run(self, query: str) -> str:
        duckduckgo_tool = DuckDuckGoSearchRun()
        
        response = duckduckgo_tool.invoke(query)

        return response

```

Then set the `tools` parameter as follows:

```auto
tools=[MyCustomDuckDuckGoTool()]

```

---

_[View the full topic](https://community.crewai.com/t/validationerror-input-should-be-a-valid-dictionary-or-instance-of-basetool/1718)._
