> ## Documentation Index
> Fetch the complete documentation index at: https://docs.xano.com/llms.txt
> Use this file to discover all available pages before exploring further.

# AI Tools

## Call AI Agent

Runs an AI agent defined in your Xano workspace. This allows you to invoke an LLM-powered agent, optionally passing arguments and enabling tool execution.

**Syntax:**

```javascript theme={null}
ai.agent.run "Agent Name" {
	args = {
		prompt: $input.user_query
		// ...other arguments
	}
	allow_tool_execution = true
} as $agent_result
```

**Example:**

```javascript theme={null}
ai.agent.run "Task Management Agent" {
	args = { prompt: $input.task }
	allow_tool_execution = true
} as $result
```

## MCP List Tools

Lists all available tools exposed by an external MCP (Model Context Protocol) server. Use this to discover tool capabilities from a remote MCP endpoint.

**Syntax:**

```javascript theme={null}
ai.external.mcp.tool.list {
	mcp_url = "https://external-mcp-server.com"
	api_key = $env.mcp_api_key
} as $tool_list
```

**Example:**

```javascript theme={null}
ai.external.mcp.tool.list {
	mcp_url = "https://my-mcp-server.com"
	api_key = $env.my_mcp_key
} as $tools
```

## MCP Call Tool

Runs a specific tool on an external MCP server, passing input parameters and receiving the tool's response.

**Syntax:**

```javascript theme={null}
ai.external.mcp.tool.run {
	mcp_url = "https://external-mcp-server.com"
	api_key = $env.mcp_api_key
	tool_name = "tool-lookup-user"
	input = {
		user_id: $input.user_id
	}
} as $tool_result
```

**Example:**

```javascript theme={null}
ai.external.mcp.tool.run {
	mcp_url = "https://my-mcp-server.com"
	api_key = $env.my_mcp_key
	tool_name = "get_user_details"
	input = { email: $input.email }
} as $user_details
```

## MCP Server Details

Retrieves metadata and configuration details about an external MCP server, such as its available tools, tags, and instructions.

**Syntax:**

```javascript theme={null}
ai.external.mcp.server_details {
	mcp_url = "https://external-mcp-server.com"
	api_key = $env.mcp_api_key
} as $server_info
```

**Example:**

```javascript theme={null}
ai.external.mcp.server_details {
	mcp_url = "https://my-mcp-server.com"
	api_key = $env.my_mcp_key
} as $details
```

## Template Engine

Renders a text or HTML template using the Twig templating engine, allowing for dynamic content generation with variables and logic.

**Syntax:**

```javascript theme={null}
util.template_engine {
	value = """
		Hello {{ $input.name }},
		{% if $input.is_premium %}
			Thank you for being a premium member!
		{% else %}
			Upgrade to premium for more features.
		{% endif %}
	"""
} as $output
```

**Example:**

```javascript theme={null}
util.template_engine {
	value = """
		<h1>Welcome, {{ $input.username }}!</h1>
		{% if $input.is_admin %}
			<p>You have admin access.</p>
		{% else %}
			<p>Standard user account.</p>
		{% endif %}
	"""
} as $html
```
