# PydanticUserError: FirecrawlCrawlWebsiteTool is not fully defined; you should define FirecrawlApp

**URL:** https://community.crewai.com/t/pydanticusererror-firecrawlcrawlwebsitetool-is-not-fully-defined-you-should-define-firecrawlapp/1745
**Category:** General
**Tags:** tools\_issues
**Created:** [November 30, 2024, 9:09pm UTC](https://community.crewai.com/t/pydanticusererror-firecrawlcrawlwebsitetool-is-not-fully-defined-you-should-define-firecrawlapp/1745 "2024-11-30T21:09:44Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Ben](https://avatars.discourse-cdn.com/v4/letter/b/df788c/32.png) [@Ben](https://community.crewai.com/u/Ben)
#### Post date: [November 30, 2024, 9:09pm UTC](https://community.crewai.com/t/pydanticusererror-firecrawlcrawlwebsitetool-is-not-fully-defined-you-should-define-firecrawlapp/1745/1 "2024-11-30T21:09:44Z")

</div>

I am trying to use the FirecrawlCrawlWebsiteTool as described [here](https://docs.crewai.com/tools/firecrawlcrawlwebsitetool) but when running this code:

from crewai\_tools import FirecrawlCrawlWebsiteTool  
tool = FirecrawlCrawlWebsiteTool(url=‘[https://www.firecrawl.dev](https://www.firecrawl.dev)’)  
text = tool.run()  
print(text)

…I am getting this error:

pydantic.errors.PydanticUserError: `FirecrawlCrawlWebsiteTool` is not fully defined; you should define `FirecrawlApp`, then call `FirecrawlCrawlWebsiteTool.model_rebuild()`.

---

<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: [December 1, 2024, 12:07pm UTC](https://community.crewai.com/t/pydanticusererror-firecrawlcrawlwebsitetool-is-not-fully-defined-you-should-define-firecrawlapp/1745/2 "2024-12-01T12:07:55Z")

</div>

@Ben Try to create a custom tool for Firecrawl.

First, install [Firecrawl SDK](https://pypi.org/project/firecrawl/):

```auto
pip install firecrawl

```

Second, create a custom tool for Firecrawl:

**tools.py**

```
from firecrawl.firecrawl import FirecrawlApp

class MyCustomTools:
    def _firecrawl():
        """
        Returns an instance of Firecrawl with the given API key.
        """

        return FirecrawlApp(api_key="xxxxx")

    @tool("Firecrawl crawl custom tool")
    def firecrawl_crawl_tool(url: str) -> str:
        """
        Crawls the given URL.
        """

        response = MyCustomTools._firecrawl().crawl_url(url)

        return response

    @staticmethod
    def get_all_firecrawl_tools():
        """
        Returns all Firecrawl tools available.
        """

        return [MyCustomTools.firecrawl_crawl_tool]

```

Third, use the custom tool:

**main.py**

```
from crewai import Agent
from tools import MyCustomTools

firecrawl_tools = MyCustomTools().get_all_firecrawl_tools()

my_agent = Agent(
    ...,
    tools=firecrawl_tools,
)

```

---

<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: [December 3, 2024, 8:42pm UTC](https://community.crewai.com/t/pydanticusererror-firecrawlcrawlwebsitetool-is-not-fully-defined-you-should-define-firecrawlapp/1745/6 "2024-12-03T20:42:16Z")

</div>



---

<div class="post-metadata">

### Author: ![Ben](https://avatars.discourse-cdn.com/v4/letter/b/df788c/32.png) [@Ben](https://community.crewai.com/u/Ben)
#### Post date: [December 3, 2024, 8:45pm UTC](https://community.crewai.com/t/pydanticusererror-firecrawlcrawlwebsitetool-is-not-fully-defined-you-should-define-firecrawlapp/1745/7 "2024-12-03T20:45:24Z")

</div>

Just wanted to say that I didn’t manage to get your example working. Maybe I made a mistake. Then I took the [CustomTool example](https://docs.crewai.com/how-to/create-custom-tools) from the CrewAI website and adapted it based on the additional logic I found from the [SerperDevTool](https://github.com/crewAIInc/crewAI-tools/blob/main/crewai_tools/tools/serper_dev_tool/serper_dev_tool.py). Below is the code, and it works now. Many thanks to @rokbenko for your suggestion which helped me to look in the right direction! 🙂

```python

import os
from typing import Type, Any
from crewai.tools import BaseTool
from pydantic import BaseModel, Field
from firecrawl import FirecrawlApp

class MyToolInput(BaseModel):
    """Input schema for MyCustomTool."""
    url: str = Field(..., description="URL of the website to scrape.")

class MyCustomTool(BaseTool):
    name: str = "Firecrawl Scrape Website Tool"
    description: str = "This tool scrapes a website and returns the text content."
    args_schema: Type[BaseModel] = MyToolInput

    def _run(self, **kwargs: Any) -> Any:

        url = kwargs.get("url")
        app = FirecrawlApp(api_key=os.getenv('FIRECRAWL_API_KEY'))
        scrape_result = app.scrape_url(url, params={'formats': ['markdown', 'html']})

        return scrape_result

tool = MyCustomTool()
text = tool.run(url='https://en.wikipedia.org/wiki/Artificial_intelligence')
print(text['markdown'])

```

---

<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: [December 3, 2024, 8:57pm UTC](https://community.crewai.com/t/pydanticusererror-firecrawlcrawlwebsitetool-is-not-fully-defined-you-should-define-firecrawlapp/1745/8 "2024-12-03T20:57:25Z")

</div>


