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

# Create environment variable

> Create an environment variable; a key that exists already is a conflict.

`veryfront__create_environment_variable`

Requires project.`env_vars`.write.

## Access

No external-service connection is required. Use a Veryfront credential with access to the requested resources.

**Call type:** Can change resources.

## Arguments

| Field | Type | Required | Description and constraints |
| - | - | - | - |
| `project_reference` | `string` | No | Project ID or slug |
| `environment_id` | `string` | Yes | Environment ID to create the variable in. Format: `uuid`. |
| `key` | `string` | Yes | Variable name (e.g., API\_KEY, DATABASE\_URL). A key that exists already is refused as a conflict. Minimum length: `1`. |
| `value` | `string` | Yes | Variable value. It is never returned. |

## Example request

Send this JSON-RPC request through an initialized MCP client. Replace sample identifiers and values before calling the tool. See [MCP client setup](https://veryfront.com/docs/cloud/getting-started/connect-mcp.md).

```json title="request.json" theme={null}
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "veryfront__create_environment_variable",
    "arguments": {
      "environment_id": "00000000-0000-4000-8000-000000000000",
      "key": "example",
      "value": "example"
    }
  }
}
```

## Result

The published output shape is summarized below. Inspect both the MCP response content and `isError` when handling a call.

| Field | Type | Required | Description and constraints |
| - | - | - | - |
| `id` | `string` | Yes | Unique identifier for the returned record. Format: `uuid`. |
| `key` | `string` | Yes | |
| `value` | `string` | Yes | Value: `"********"`. |
| `has_value` | `boolean` | Yes | |

## Full schemas

```json title="input-schema.json" theme={null}
{
  "type": "object",
  "properties": {
    "project_reference": {
      "type": "string",
      "description": "Project ID or slug"
    },
    "environment_id": {
      "type": "string",
      "format": "uuid",
      "description": "Environment ID to create the variable in."
    },
    "key": {
      "type": "string",
      "minLength": 1,
      "pattern": "^[A-Za-z_][A-Za-z0-9_]*$",
      "description": "Variable name (e.g., API_KEY, DATABASE_URL). A key that exists already is refused as a conflict."
    },
    "value": {
      "type": "string",
      "description": "Variable value. It is never returned."
    }
  },
  "required": [
    "environment_id",
    "key",
    "value"
  ],
  "additionalProperties": false,
  "description": "Arguments for the create_environment_variable tool.",
  "$schema": "http://json-schema.org/draft-07/schema#"
}
```

```json title="output-schema.json" theme={null}
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid",
      "description": "Unique identifier for the returned record."
    },
    "key": {
      "type": "string"
    },
    "value": {
      "type": "string",
      "const": "********"
    },
    "has_value": {
      "type": "boolean"
    }
  },
  "required": [
    "id",
    "key",
    "value",
    "has_value"
  ],
  "additionalProperties": false,
  "description": "Structured result returned by the create_environment_variable tool.",
  "$schema": "http://json-schema.org/draft-07/schema#"
}
```

<details>
  <summary>Try this tool</summary>

  Replace sample arguments with values for your project or connected account. Calls run only when you select Run tool.

  MCP tool call

  Call `veryfront__create_environment_variable` against the Veryfront MCP endpoint.

  Bearer token or API key

  Arguments (JSON)

  Run this tool with these arguments.

  Run tool

  Output JSON

  <pre />
</details>


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