> To build or manage a Wix site with an AI agent, follow https://www.wix.com/headless/skill.md
> It builds a new Wix site or puts your own site online, from a prompt, and keeps changing it afterwards. The pages are code in any web technology, and Wix runs the backend.
> It works through the Wix plugin (the Wix MCP and the Wix skills), the Wix CLI or no Wix login, and puts the site live on Wix hosting or on another host.
> Business features include a store, bookings, events and tickets, a restaurant, a blog, forms, members and many more.
> Read the Wix skills online at https://www.wix.com/skills
> 
> Portal Navigation:
> 
> - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version.
> - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages).
> - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`).
> - If a reference page seems to be missing its schema (parameters, return types, or type definitions), append `?schema=true` to its `.md` URL (e.g. `https://dev.wix.com/docs/contexts/contexts/stores/category-info/use-category-info-context.md?schema=true`).
> - Top-level index of all portals: https://dev.wix.com/docs/llms.txt
> - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt

## Resource: Introduction

## Article: Introduction

## Article Link: https://dev.wix.com/docs/api-reference/app-management/app-tools/tools-provider-v1/introduction.md

## Article Content:

# About the Tools Provider Service Plugin

The Tools Provider service plugin lets your app expose tools that [Aria](https://dev.wix.com/docs/overview/ai-the-wix-platform/about-aria.md) can discover and use during conversations with Wix users.

Expose any of your app's functionality as tools for Aria to use, including 3rd-party API and service integrations, data retrieval, workflows, and actions.

## Before you begin

It's important to note the following before starting to code:

- Set up a [CLI](https://dev.wix.com/docs/wix-cli.md) or [self-managed](https://dev.wix.com/docs/build-apps/develop-your-app/develop-a-self-managed-app/about-self-managed-apps.md) project. For more details about supported development paths, see [App Tools across development paths](https://dev.wix.com/docs/overview/extensions-framework/backend-extensions/app-tools.md#app-tools-across-development-paths).
- Your app can include up to 100 tools. 

## Extensions configuration

Exposing a tool to Aria requires you to configure the following [backend extensions](https://dev.wix.com/docs/build-apps/develop-your-app/extensions/backend-extensions/about-backend-extensions.md):

+ [App Tools](https://dev.wix.com/docs/build-apps/develop-your-app/extensions/backend-extensions/app-tools/about-app-tools-extensions.md): A backend extension that declares which tools your app offers.
+ Tools Provider: A service plugin that enables Aria to run a specified tool.

Additionally, your app must implement the [`runTool()`](#tools-provider-handler) handler so Aria can execute your tools.

For an end-to-end example, see [Get a package's status with Aria](https://dev.wix.com/docs/api-reference/app-management/app-tools/tools-provider-v1/sample-flows.md).

## Set up

::::tabs
:::CLI

To set up the App Tools and Tools Provider extensions using the Wix CLI, make sure you have an existing CLI project and that you're logged in to your Wix account.

<blockquote class="tip">

__Tip:__
Use the [App Tools skill](https://github.com/wix/skills/blob/main/skills/wix-app/references/APP_TOOLS.md) to give your AI agent the context it needs to scaffold and implement App Tools and the Tools Provider service plugin.

</blockquote>

**App Tools Extension**

1. Run [`wix generate`](https://dev.wix.com/docs/wix-cli/command-reference/project-commands/generate.md).
2. Select **App Tools** from the list of available backend extension types.
3. Provide a name for your extension. 

The CLI generates the [extension files](https://dev.wix.com/docs/build-apps/develop-your-app/develop-an-app-with-the-cli/supported-extensions/backend/app-tools/app-tools-extension-files-and-code.md) and registers them in `src/extensions.ts`.

**Tools Provider service plugin**

1. Run [`wix generate`](https://dev.wix.com/docs/wix-cli/command-reference/project-commands/generate.md).
2. Select **Service Plugin** from the list of available backend extension types.
3. Select **Tools Provider** from the list of available service plugins.
4. Provide a name for your service plugin.

The CLI generates the [extension files](https://dev.wix.com/docs/build-apps/develop-your-app/develop-an-app-with-the-cli/supported-extensions/backend/app-tools/app-tools-extension-files-and-code.md) and registers them in `src/extensions.ts`.

:::
:::Self-managed

To set up the App Tools and Tools Provider extensions, go to [Extensions](https://dev.wix.com/docs/build-apps/develop-your-app/extensions/about-extensions.md) in your app's dashboard.

**App Tools**

1. Click **Create Extension** in the top right.
2. Find **App Tools** and click **Create**.
3. Configure an array of tools in the JSON editor. For details, see [About App Tools Extensions](https://dev.wix.com/docs/build-apps/develop-your-app/extensions/backend-extensions/app-tools/about-app-tools-extensions.md).
4. Click **Save**.

**Tools Provider**

1. Click **Create Extension** in the top right.
2. Find **Tools Provider Config** and click **Create**.
3. Set the [Tools Provider Extension Config](https://dev.wix.com/docs/api-reference/app-management/app-tools/tools-provider-v1/extension-config.md) to enable Wix to locate your tools and expose them to Aria.
4. Click **Save**.

:::
::::

## Tools Provider handler

Use [`toolsProvider.provideHandlers()`](https://dev.wix.com/docs/build-apps/develop-your-app/develop-a-self-managed-app/supported-extensions/backend-extensions/service-plugins/add-self-managed-service-plugin-extensions-with-the-sdk.md) to define the following handler method in your app:

| Method | Required |
| --- | --- |
| [`runTool()`](https://dev.wix.com/docs/api-reference/app-management/app-tools/tools-provider-v1/run-tool.md) | Yes |

When Aria selects a tool, Wix calls your handler with that tool's `methodName` and a `payload` shaped by the tool's `requestSchema`. Your handler routes on `methodName`, runs the tool, and returns data matching the tool's `responseSchema`. Aria uses that response to answer the Wix user in natural language.

::::tabs
:::CLI

This is the basic code structure for implementing the Tools Provider service plugin with the Wix CLI:

```js
import { toolsProvider } from '@wix/app-tools/service-plugins';

toolsProvider.provideHandlers({
  runTool: async (payload) => {
    const { request, metadata } = payload;

    // Add your logic here

  }
});
```

> **Note:** Use [elevation](https://dev.wix.com/docs/build-apps/develop-your-app/access/authorization/about-elevation.md) when calling Wix APIs from the Tools Provider handler.

:::
:::Self-managed

This is the basic code structure for implementing the Tools Provider service plugin in a self-managed project:

```js
import { createClient } from '@wix/sdk';
import { toolsProvider } from '@wix/app-tools/service-plugins';

const wixClient = createClient({
  auth: {
    appId: '<YOUR_APP_ID>',
    publicKey: '<YOUR_APP_PUBLIC_KEY>'
  },
  modules: { toolsProvider }
});

wixClient.toolsProvider.provideHandlers({
  runTool: async (payload) => {
    const { request, metadata } = payload;

    // Add your logic here

  }
});

// Implement a router to process all requests
express.post('/plugins-and-webhooks/*', (req, res) => {
  wixClient.process(req);
});
```

:::
::::

## See also

+ [About Aria](https://dev.wix.com/docs/overview/ai-the-wix-platform/about-aria.md)
+ [AI on the Wix Platform](https://dev.wix.com/docs/overview/ai-the-wix-platform/ai-on-the-wix-platform.md)
+ [App Tools](https://dev.wix.com/docs/overview/extensions-framework/backend-extensions/app-tools.md)
+ [About App Tools Extensions](https://dev.wix.com/docs/build-apps/develop-your-app/extensions/backend-extensions/app-tools/about-app-tools-extensions.md)
+ [Add App Tools Extensions with the Wix CLI](https://dev.wix.com/docs/build-apps/develop-your-app/develop-an-app-with-the-cli/supported-extensions/backend/app-tools/add-app-tools-extensions-with-the-wix-cli.md)
+ [App Tools Extension Files and Code](https://dev.wix.com/docs/build-apps/develop-your-app/develop-an-app-with-the-cli/supported-extensions/backend/app-tools/app-tools-extension-files-and-code.md)
+ [Add App Tools Extensions with the Wix CLI (Headless)](https://dev.wix.com/docs/go-headless/wix-managed-headless/full-integration-astro/extensions/backend/app-tools/add-app-tools-extensions-with-the-wix-cli.md)
+ [App Tools Extension Files and Code (Headless)](https://dev.wix.com/docs/go-headless/wix-managed-headless/full-integration-astro/extensions/backend/app-tools/app-tools-extension-files-and-code.md)