> 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`).
> - Top-level index of all portals: https://dev.wix.com/docs/llms.txt
> - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt

# SetToolsProvidersToggle

# Package: appTools

# Namespace: ToolsHost

# Method link: https://dev.wix.com/docs/api-reference/app-management/app-tools/tools-host/set-tools-providers-toggle.md

## Permission Scopes:
Invoke App Tools: SCOPE.APP_TOOLS.INVOKE

## Introduction

Enables or disables the tools of one or more apps for the site in context.

A disabled app stays in the List Tools Providers response with `settings.enabled` set to `false`, and Invoke
Tool rejects its tools. Apps that aren't installed on the site, or have no Tools Provider extension, are ignored.
Settings for individual tools are kept; to change those, call Set Tools Toggle.

---

## REST API

### Schema

```
 Method: setToolsProvidersToggle
 Description: Enables or disables the tools of one or more apps for the site in context.  A disabled app stays in the List Tools Providers response with `settings.enabled` set to `false`, and Invoke Tool rejects its tools. Apps that aren't installed on the site, or have no Tools Provider extension, are ignored. Settings for individual tools are kept; to change those, call Set Tools Toggle.
 URL: https://www.wixapis.com/_api/tools-host/v1/set-tools-providers-toggle
 Method: POST
 Method parameters:
   param name: providers | type: array<providers> | description: Apps whose tools to enable or disable for the site. When the same app appears more than once, the last entry wins.  | validation: minItems 1, maxItems 30
              - name: providerAppId | type: string | description: GUID of the app that provides the tools.  | validation: format GUID
              - name: enabled | type: boolean | description: Whether the app's tools are enabled for the site.  
 Return type: SetToolsProvidersToggleResponse
  EMPTY-OBJECT {}


```

### Examples

### Switch an app's tools off for a site
Disables every tool of one installed app for the site. Invoke Tool then rejects the app's tools with PROVIDER_DISABLED until the app is enabled again.

```curl
curl -X POST \
'https://www.wixapis.com/_api/tools-host/v1/set-tools-providers-toggle' \
-H 'Authorization: <AUTH>' \
-H 'Content-Type: application/json' \
-H 'wix-site-id: <SITE_ID>' \
-d '{
  "providers": [
    {
      "providerAppId": "dc3d45f5-4f88-4f7f-92f9-f00c98ed745d",
      "enabled": false
    }
  ]
}'
```

---

## JavaScript SDK

### Schema

```
 Method: wixClientAdmin.appTools.toolsHost.setToolsProvidersToggle(options)
 Description: Enables or disables the tools of one or more apps for the site in context.  A disabled app stays in the List Tools Providers response with `settings.enabled` set to `false`, and Invoke Tool rejects its tools. Apps that aren't installed on the site, or have no Tools Provider extension, are ignored. Settings for individual tools are kept; to change those, call Set Tools Toggle.
 Method parameters:
   param name: options | type: SetToolsProvidersToggleOptions  none  
        - name: providers | type: array<ProviderToggle> | description: Apps whose tools to enable or disable for the site. When the same app appears more than once, the last entry wins.  | validation: minItems 1, maxItems 30
           - name: providerAppId | type: string | description: GUID of the app that provides the tools.  | validation: format GUID
           - name: enabled | type: boolean | description: Whether the app's tools are enabled for the site.  
 Return type: PROMISE<SetToolsProvidersToggleResponse>
  EMPTY-OBJECT {}


```

### Examples

### Switch an app's tools off for a site
Disables every tool of one installed app for the site. Invoke Tool then rejects the app's tools until the app is enabled again.

```javascript
import { toolsHost } from "@wix/app-tools";

async function setToolsProvidersToggle() {
  const response = await toolsHost.setToolsProvidersToggle({
    providers: [
      {
        providerAppId: "dc3d45f5-4f88-4f7f-92f9-f00c98ed745d",
        enabled: false,
      },
    ],
  });
}

/* Promise resolves to:
 * {}
 */

```

### setToolsProvidersToggle (self-hosted)
Self-hosted SDK calls require you to [create a client](https://dev.wix.com/docs/sdk/articles/work-with-the-sdk/about-the-wix-client.md).

```javascript
import { createClient } from '@wix/sdk';
import { toolsHost } from '@wix/app-tools';
// Import the auth strategy for the relevant access type
// Import the relevant host module if needed

const myWixClient = createClient ({
  modules: { toolsHost },
  // Include the auth strategy and host as relevant
});


async function setToolsProvidersToggle(options) {
  const response = await myWixClient.toolsHost.setToolsProvidersToggle(options);
};
```

---