is there any why or API through which i can list a...
# ask-ai
a
is there any why or API through which i can list all the funtion_tools associated with agent?
t
Thanks for reaching out, maleek. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
I'm happy to help you explore how to list all the function tools associated with an agent! You can easily access them using the
tools
property of the
Agent
class. This property gives you a list of tools defined within the agent class or those passed during initialization. Here's a simple example to get you started:
Copy code
agent = MyAgent(...)  # Your agent instance
function_tools = agent.tools  # Returns list of FunctionTool | RawFunctionTool
What's even better is that you can update these tools dynamically using the
update_tools()
method. Let me show you how:
Copy code
# To add a tool
await agent.update_tools(agent.tools + [tool_a])

# To remove a tool
await agent.update_tools([t for t in agent.tools if t != tool_a])

# To replace all tools
await agent.update_tools([tool_a, tool_b])
If your agent is connected with Model Context Protocol (MCP) servers, it’s great to know that tools from these servers are automatically fetched and combined with your agent’s native tools. You can also retrieve these tools using the
list_tools()
method of the
MCPServer
class. If you’d like to dive deeper or need more examples, feel free to check out the LiveKit documentation. I’m here if you have any more questions or want to explore this further together! Sources: livekit-agents/livekit/agents/llm/__init__.py | Tool definition and use | LiveKit Docs
a
if i got
function_tools
using the following code:
function_tools = agent.tools
then how can i log them using
logger.debug
or
<http://logger.info|logger.info>
, bcz if i simply use
<http://logger.info|logger.info>(f"Assistant tools: {tools}")
, it then only displays object address or code idk:
<bound method VoiceAssistant.get_customer_and_equipment_details_by_name of <__mp_main__.VoiceAssistant object at 0x7bce8dbff110>>
t
I'd love to help you log the function tools properly! Could you please share a bit more about the structure of the tools returned by
agent.tools
? For instance, are they objects with certain attributes or methods that you'd like to log? If you can provide an example of the tool's structure or let me know which details you're interested in logging, I’ll be able to guide you more effectively.
a
this is the structure that i am getting in logs:
Assistant tools: [<bound method VoiceAssistant.get_customer_and_equipment_details_by_name of <__mp_main__.VoiceAssistant object at 0x7bce8dbff110>>]
t
I don't have the answer you're looking for. You could also try asking your question: • in one of the other Slack channels or • to https://deepwiki.com/livekit/livekit_composite which is trained on all LiveKit source code If you find the answer, please post it here to help others!