Forcing Tool Output as Result

Hi all, I have been using a multi-agent framework, where the last agent is always required to use the tool and generate the tool’s output. So, I built a custom tool, and now I want my last agent to use the output of the second last agent as input, run the tool and then generate the output. After this, the crew should end. However, at the end its still thinking and taking some time to end the crew even after running the tool. I got the below text from Crew AI documentation but its giving me an error that the custom tool object is not callable.
"from crewai.agent import Agent
from my_tool import MyCustomTool

Create a coding agent with the custom tool

coding_agent = Agent(
role=“Data Scientist”,
goal=“Produce amazing reports on AI”,
backstory=“You work with data and AI”,
tools=[MyCustomTool(result_as_answer=True)],
)

Assuming the tool’s execution and result population occurs within the system

task_result = coding_agent.execute_task(task)"

Can you share the custom tool code? This might help other people to be able to help you better.