List an agent's tools
Updated
A script lists an AI agent’s tools at startup: each AI Tool’s label, how many tools its script declares and whether it is switched on.
Read the tool list in the log. No conversation is started, so the example needs no AI service.
List an agent's tools
#pragma lifecycle(startup)
function startup() { const tools = findEntity('Guide').getComponents(AIToolComponent); if (tools.length === 0) return log('The guide has no tools.');
for (const tool of tools) { const declared = tool.props.code.split('pragma tool(').length - 1; log(`"${tool.props.name}": ${declared} tool(s), ${tool.enabled ? 'on' : 'off'}`); }}How it works
Section titled “How it works”The script is explained step by step in List an agent’s tools.
Open it in XR Creator
Section titled “Open it in XR Creator”Download the project file below, then import it in XR Hub with Projects › New › Import, as described in Projects and templates. It opens in XR Creator with the same scene you see running above, each script already attached to its Behavior entity. From there you can edit the scripts, adjust components and their props, preview your changes, and deploy the result as a world of your own.
ToolInventory.xrproj