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

# MCP tools · Functions

> Tools for the script's backend: list, create from templates, deploy and test functions.

Tools for the script's backend: list, create from templates, deploy and test functions.

| Tool | What it does | Type |
| - | - | - |
| `list_functions` | The script's backend functions. | Read |
| `create_function` | Writes supabase/functions/\<name>.js from a template (hello, save, ai, access). Then use deploy\_functions. | Write |
| `deploy_functions` | Deploys the backend from the main branch. | Write |
| `test_function` | Calls the function as you; body becomes request.body. | Write |

## list\_functions

**List functions.** The script's backend functions.

> [!NOTE]
>
> Read only: changes nothing. Confirmation belongs to the AI client; scopes and blocks still apply.

### Parameters

**script\_id** `string` *required*

Script ID (uuid)

### What it calls in the API

Por baixo, a ferramenta usa `GET /scripts/{script_id}/functions` da [API do Scripts](https://docs.doglytdc.dev/en/scripts/api.md). The response includes text and structuredContent, with secrets removed.

### Example

```json Request theme={null}
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "list_functions",
    "arguments": {
      "script_id": "8f0c2c1e-5b0a-4d2e-9a61-3f7d2b1c9e40"
    }
  }
}
```

```json Response theme={null}
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "content": [
      {
        "type": "text",
        "text": "{ ...response JSON... }"
      }
    ],
    "isError": false
  }
}
```

## create\_function

**Create function from template.** Writes supabase/functions/\<name>.js from a template (hello, save, ai, access). Then use deploy\_functions.

> [!NOTE]
>
> Writes or changes script data. Confirmation belongs to the AI client; scopes and blocks still apply.

### Parameters

**script\_id** `string` *required*

Script ID (uuid)

**name** `string` *required*

Name (a-z, 0-9, - and \_)

**template** `string` *required*

Template Values: `hello`, `save`, `ai`, `access`.

**expected\_head** `string` *required*

head\_sha of main

### What it calls in the API

Por baixo, a ferramenta usa `POST /scripts/{script_id}/repo/commits` da [API do Scripts](https://docs.doglytdc.dev/en/scripts/api.md). The response includes text and structuredContent, with secrets removed.

### Example

```json Request theme={null}
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "create_function",
    "arguments": {
      "script_id": "8f0c2c1e-5b0a-4d2e-9a61-3f7d2b1c9e40",
      "name": "hello",
      "template": "hello",
      "expected_head": "3b1f0e9c2a7d4b6e8f0a1c3d5e7f9a1b2c3d4e5f"
    }
  }
}
```

```json Response theme={null}
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "content": [
      {
        "type": "text",
        "text": "{ ...response JSON... }"
      }
    ],
    "isError": false
  }
}
```

## deploy\_functions

**Deploy functions.** Deploys the backend from the main branch.

> [!NOTE]
>
> Writes or changes script data. Destructive action: review in your AI client before confirming. Confirmation belongs to the AI client; scopes and blocks still apply.

### Parameters

**script\_id** `string` *required*

Script ID (uuid)

### What it calls in the API

Por baixo, a ferramenta usa `POST /scripts/{script_id}/deploy` da [API do Scripts](https://docs.doglytdc.dev/en/scripts/api.md). The response includes text and structuredContent, with secrets removed.

### Example

```json Request theme={null}
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "deploy_functions",
    "arguments": {
      "script_id": "8f0c2c1e-5b0a-4d2e-9a61-3f7d2b1c9e40"
    }
  }
}
```

```json Response theme={null}
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "content": [
      {
        "type": "text",
        "text": "{ ...response JSON... }"
      }
    ],
    "isError": false
  }
}
```

## test\_function

**Test function.** Calls the function as you; body becomes request.body.

> [!NOTE]
>
> Writes or changes script data. Destructive action: review in your AI client before confirming. Confirmation belongs to the AI client; scopes and blocks still apply.

### Parameters

**script\_id** `string` *required*

Script ID (uuid)

**name** `string` *required*

Name

**body** `object`

—

### What it calls in the API

Por baixo, a ferramenta usa `POST /scripts/{script_id}/functions/{name}` da [API do Scripts](https://docs.doglytdc.dev/en/scripts/api.md). The response includes text and structuredContent, with secrets removed.

### Example

```json Request theme={null}
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "test_function",
    "arguments": {
      "script_id": "8f0c2c1e-5b0a-4d2e-9a61-3f7d2b1c9e40",
      "name": "hello"
    }
  }
}
```

```json Response theme={null}
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "content": [
      {
        "type": "text",
        "text": "{ ...response JSON... }"
      }
    ],
    "isError": false
  }
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.