> For the complete documentation index, see [llms.txt](https://developers.felt.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developers.felt.com/js-sdk-api-reference/tools/toolscontroller.md).

# ToolsController

***

The Tools controller allows you to let users draw elements on the map.

## Extended by

* [`FeltController`](/js-sdk-api-reference/main/feltcontroller.md)

## Methods

### setTool()

> **setTool**(`tool`: `null` | [`ToolType`](/js-sdk-api-reference/tools/tooltype.md)): `void`

Sets the tool to use for drawing elements on the map.

Use this method to programmatically activate drawing tools for users. When a tool is set, users can draw elements on the map using that tool. Set to `null` to deactivate all drawing tools.

#### Parameters

| Parameter | Type                                                            | Description                                         |
| --------- | --------------------------------------------------------------- | --------------------------------------------------- |
| `tool`    | `null` \| [`ToolType`](/js-sdk-api-reference/tools/tooltype.md) | The tool to set, or `null` to deactivate all tools. |

#### Returns

`void`

#### Example

```typescript
// Set the tool to "marker"
await felt.setTool("marker");

// put down the tool
await felt.setTool(null);
```

***

### getTool()

> **getTool**(): `Promise`<`null` | [`ToolType`](/js-sdk-api-reference/tools/tooltype.md)>

Gets the current tool, if any is in use.

Use this method to check which drawing tool is currently active, if any.

#### Returns

`Promise`<`null` | [`ToolType`](/js-sdk-api-reference/tools/tooltype.md)>

A promise that resolves to the current tool, or `null` if no tool is in use.

#### Example

```typescript
const tool = await felt.getTool(); // "marker", "polygon", etc.
```

***

### onToolChange()

> **onToolChange**(`args`: { `handler`: (`tool`: `null` | [`ToolType`](/js-sdk-api-reference/tools/tooltype.md)) => `void`; }): `VoidFunction`

Listens for changes to the current tool.

Use this to react to tool changes, such as updating your UI to reflect the currently active drawing tool.

#### Parameters

| Parameter      | Type                                                                                                | Description                                                              |
| -------------- | --------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------ |
| `args`         | { `handler`: (`tool`: `null` \| [`ToolType`](/js-sdk-api-reference/tools/tooltype.md)) => `void`; } | -                                                                        |
| `args.handler` | (`tool`: `null` \| [`ToolType`](/js-sdk-api-reference/tools/tooltype.md)) => `void`                 | This callback is called with the current tool whenever the tool changes. |

#### Returns

`VoidFunction`

#### Example

```typescript
const unsubscribe = felt.onToolChange({
  handler: tool => console.log(tool),
});

// later on...
unsubscribe();
```

***

### setToolSettings()

> **setToolSettings**(`settings`: [`InputToolSettings`](/js-sdk-api-reference/tools/inputtoolsettings.md)): `void`

Sets the settings for the current tool.

Use this method to configure how drawing tools behave, such as setting colors, stroke widths, or other tool-specific properties.

#### Parameters

| Parameter  | Type                                                                    | Description                                 |
| ---------- | ----------------------------------------------------------------------- | ------------------------------------------- |
| `settings` | [`InputToolSettings`](/js-sdk-api-reference/tools/inputtoolsettings.md) | The settings to set for the specified tool. |

#### Returns

`void`

#### Example

```typescript
// Set the settings for the marker tool
await felt.setToolSettings({
  tool: "marker",
  color: "#FE17",
});
```

***

### getToolSettings()

> **getToolSettings**<`T`>(`tool`: `T`): `Promise`<[`ToolSettingsMap`](/js-sdk-api-reference/tools/toolsettingsmap.md)\[`T`]>

Gets the settings for the chosen tool.

Use this method to retrieve the current configuration of a drawing tool.

#### Type Parameters

| Type Parameter                                                                              |
| ------------------------------------------------------------------------------------------- |
| `T` *extends* [`ConfigurableToolType`](/js-sdk-api-reference/tools/configurabletooltype.md) |

#### Parameters

| Parameter | Type | Description                   |
| --------- | ---- | ----------------------------- |
| `tool`    | `T`  | The tool to get settings for. |

#### Returns

`Promise`<[`ToolSettingsMap`](/js-sdk-api-reference/tools/toolsettingsmap.md)\[`T`]>

A promise that resolves to the settings for the chosen tool.

#### Example

```typescript
const settings = await felt.getToolSettings("marker");
```

***

### onToolSettingsChange()

> **onToolSettingsChange**(`args`: { `handler`: (`settings`: [`ToolSettingsChangeEvent`](/js-sdk-api-reference/tools/toolsettingschangeevent.md)) => `void`; }): `VoidFunction`

Listens for changes to the settings on all tools.

Use this to react to tool setting changes, such as updating your UI to reflect the current tool configuration.

#### Parameters

| Parameter      | Type                                                                                                                        |
| -------------- | --------------------------------------------------------------------------------------------------------------------------- |
| `args`         | { `handler`: (`settings`: [`ToolSettingsChangeEvent`](/js-sdk-api-reference/tools/toolsettingschangeevent.md)) => `void`; } |
| `args.handler` | (`settings`: [`ToolSettingsChangeEvent`](/js-sdk-api-reference/tools/toolsettingschangeevent.md)) => `void`                 |

#### Returns

`VoidFunction`

A function to unsubscribe from the listener.

#### Example

```typescript
const unsubscribe = felt.onToolSettingsChange({
  handler: settings => console.log(settings),
});

// later on...
unsubscribe();
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://developers.felt.com/js-sdk-api-reference/tools/toolscontroller.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
