---
type: api
title: Create a tool
description: Create a new tool. Use this endpoint to define a custom tool with specific functionality and configuration for use by agents. To learn more about Agent Builder tools, refer to the [tools documentation](https://www.elastic.co/docs/explore-analyze/ai-features/agent-builder/tools).<br/><br/>[Required authorization] Route required privileges: agentBuilder:manageTools.
url: https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/kibana/v0/operation/operation-post-agent-builder-tools
resource: https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/kibana/v0/operation/operation-post-agent-builder-tools
products:
  - Kibana
---

# Create a tool

Availability: 9.2+

- Server: `https://{kibana_url}`

## Paths

- `POST` `/api/agent_builder/tools`

- [Api key auth](/elastic/docs-builder/docs/4371/api/doc/kibana/v0/authentication#apikeyauth)
- [Basic auth](/elastic/docs-builder/docs/4371/api/doc/kibana/v0/authentication#basicauth)

## Description

Create a new tool. Use this endpoint to define a custom tool with specific functionality and configuration for use by agents. To learn more about Agent Builder tools, refer to the [tools documentation](https://www.elastic.co/docs/explore-analyze/ai-features/agent-builder/tools).<br/><br/>[Required authorization] Route required privileges: agentBuilder:manageTools.

## Request Body

`application/json`

- `configuration` (map string to object) — required
  Tool-specific configuration parameters. See examples for details.
- `confirmation` (object) — optional
  Optional tool call policy to control tool call confirmation behavior
  - `askUser` (enum) — optional
    Values: `once`, `always`, `never`
- `description` (string) — optional
  Description of what the tool does.
- `id` (string) — required
  Unique identifier for the tool.
- `tags` ([] string · default: []) — optional
  Optional tags for categorizing and organizing tools.
- `type` (enum) — required
  The type of tool to create (e.g., esql, index_search).
  Values: `esql`, `index_search`, `workflow`, `mcp`

## Response

Indicates a successful response

## Code Examples

#### Console

```console
POST kbn:/api/agent_builder/tools
{
  "id": "example-esql-tool",
  "type": "esql",
  "description": "An ES|QL query tool for analyzing financial trades with time filtering",
  "tags": ["analytics", "finance", "updated"],
  "configuration": {
    "query": "FROM financial_trades | WHERE execution_timestamp >= ?startTime | STATS trade_count=COUNT(*), avg_price=AVG(execution_price) BY symbol | SORT trade_count DESC | LIMIT ?limit",
    "params": {
      "startTime": {
        "type": "date",
        "description": "Start time for the analysis in ISO format"
      },
      "limit": {
        "type": "integer",
        "description": "Maximum number of results to return"
      }
    }
  }
}
```

#### curl

```curl
curl \
 -X POST "https://${KIBANA_URL}/api/agent_builder/tools" \
 -H "Authorization: ApiKey ${API_KEY}" \
 -H "kbn-xsrf: true" \
 -H "Content-Type: application/json" \
 -d '{
   "id": "example-esql-tool",
   "type": "esql",
   "description": "Example ES|QL query tool for analyzing financial trades with time filtering",
   "tags": ["analytics", "finance"],
   "configuration": {
     "query": "FROM financial_trades | WHERE execution_timestamp >= ?startTime | STATS trade_count=COUNT(*), avg_price=AVG(execution_price) BY symbol | SORT trade_count DESC | LIMIT ?limit",
     "params": {
       "startTime": {
         "type": "date",
         "description": "Start time for the analysis in ISO format"
       },
       "limit": {
         "type": "integer",
         "description": "Maximum number of results to return"
       }
     }
   }
 }'
```

## Response Examples

#### Create ES|QL tool

Example response returning a definition of ESQL tool created

```json
{
  "configuration": {
    "params": {
      "limit": {
        "description": "Maximum number of results to return",
        "type": "integer"
      },
      "startTime": {
        "description": "Start time for the analysis in ISO format",
        "type": "date"
      }
    },
    "query": "FROM financial_trades | WHERE execution_timestamp \u003E= ?startTime | STATS trade_count=COUNT(*), avg_price=AVG(execution_price) BY symbol | SORT trade_count DESC | LIMIT ?limit"
  },
  "description": "Example ES|QL query tool for analyzing financial trades with time filtering",
  "id": "example-esql-tool",
  "readonly": false,
  "schema": {
    "$schema": "http://json-schema.org/draft-07/schema#",
    "additionalProperties": false,
    "description": "Parameters needed to execute the query",
    "type": "object",
    "properties": {
      "limit": {
        "description": "Maximum number of results to return",
        "type": "integer"
      },
      "startTime": {
        "description": "Start time for the analysis in ISO format",
        "format": "date-time",
        "type": "string"
      }
    },
    "required": [
      "startTime",
      "limit"
    ]
  },
  "tags": [
    "analytics",
    "finance"
  ],
  "type": "esql"
}
```

#### Create index search tool

Example response returning a definition of search tool tool created

```json
{
  "configuration": {
    "pattern": "financial_*"
  },
  "description": "Search tool specifically for financial data analysis and reporting",
  "id": "example-index-search-tool",
  "readonly": false,
  "schema": {
    "$schema": "http://json-schema.org/draft-07/schema#",
    "additionalProperties": false,
    "type": "object",
    "properties": {
      "nlQuery": {
        "description": "A natural language query expressing the search request",
        "type": "string"
      }
    },
    "required": [
      "nlQuery"
    ]
  },
  "tags": [
    "search",
    "finance"
  ],
  "type": "index_search"
}
```

