From 5dc8dd0e8a8c7f9fdab9e4ed990927ee0b2f5141 Mon Sep 17 00:00:00 2001 From: Brandon Hancock Date: Fri, 10 Jan 2025 20:48:59 -0500 Subject: [PATCH] add important missing parts to creating tools --- docs/concepts/tools.mdx | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/docs/concepts/tools.mdx b/docs/concepts/tools.mdx index 8abe0f4e6..fa823d0b9 100644 --- a/docs/concepts/tools.mdx +++ b/docs/concepts/tools.mdx @@ -150,15 +150,20 @@ There are two main ways for one to create a CrewAI tool: ```python Code from crewai.tools import BaseTool +from pydantic import BaseModel, Field +class MyToolInput(BaseModel): + """Input schema for MyCustomTool.""" + argument: str = Field(..., description="Description of the argument.") 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." + description: str = "What this tool does. It's vital for effective utilization." + args_schema: Type[BaseModel] = MyToolInput def _run(self, argument: str) -> str: - # Implementation goes here - return "Result from custom tool" + # Your tool's logic here + return "Tool's result" ``` ### Utilizing the `tool` Decorator