# updatePrompt

```graphql
mutation UpdatePrompt($projectReference: String!, $id: String!, $input: UpdatePromptInput!) {
  updatePrompt(projectReference: $projectReference, id: $id, input: $input) {
    id
    name
    description
    content
    sourcePath
    source
    editMode
    sourceOnlyReasons
  }
}
```

Replace the content and description of a structured prompt, where REST and GraphQL clear an omitted description and the MCP tool keeps it; returns the updated prompt source document. Requires project.agents.write.

## Arguments

| Name                     | Type               | Required | Description                                                               |
| ------------------------ | ------------------ | -------- | ------------------------------------------------------------------------- |
| `projectReference`       | String!            | Yes      |                                                                           |
| `id`                     | String!            | Yes      | The id of the definition, from its list.                                  |
| `input`                  | UpdatePromptInput! | Yes      |                                                                           |
| `input.description`      | String             |          | Replaces the description; omit it or send null to clear it.               |
| `input.content`          | String!            | Yes      |                                                                           |
| `input.sourceTargetKind` | WriteTargetKind    |          | The source to write; default project. One of `project`, `preview_branch`. |
| `input.targetBranchId`   | ID                 |          | Required with the kind preview\_branch.                                   |

## Variables

```json
{
  "projectReference": "string",
  "id": "string",
  "input": {
    "content": "string"
  }
}
```

## Responses

| Status | Description                             |
| ------ | --------------------------------------- |
| 200    | The PromptSource! in data.updatePrompt. |

## Call it

```bash
curl -X POST "https://api.veryfront.com/graphql" \
  -H "Authorization: Bearer $VERYFRONT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "query": "mutation UpdatePrompt($projectReference: String!, $id: String!, $input: UpdatePromptInput!) {\n  updatePrompt(projectReference: $projectReference, id: $id, input: $input) {\n    id\n    name\n    description\n    content\n    sourcePath\n    source\n    editMode\n    sourceOnlyReasons\n  }\n}",
  "variables": {
    "projectReference": "string",
    "id": "string",
    "input": {
      "content": "string"
    }
  }
}'
```

## Example response

```json
{
  "data": {
    "updatePrompt": {
      "id": "string",
      "name": "string",
      "description": "string",
      "content": "string",
      "sourcePath": "string",
      "source": "string",
      "editMode": "structured",
      "sourceOnlyReasons": [
        "string"
      ]
    }
  }
}
```
