# RevCent MCP Operation: `EditAIPrompt`

This document explains the `EditAIPrompt` operation in depth so MCP clients can correctly update existing AI Prompts in RevCent.

This is an operation-specific MCP guide. It explains partial edit behavior, required fields, editable properties, explicit user-request requirements, validation rules, examples, and common mistakes.

Sources:
- RevCent API/MCP schema for `EditAIPrompt`
- RevCent API/MCP schema for `CreateAIPrompt`

---

## Operation Summary

`EditAIPrompt` edits an existing AI Prompt using the required `ai_prompt_id`.

The operation supports partial edits.

The schema description says:

```text
Only provide the properties you wish to modify.
```

Required:

```text
ai_prompt_id
```

Editable:

```text
name
prompt
```

---

# Critical Rule: Only Edit When Explicitly Asked

MCP should only call `EditAIPrompt` when the user or MCP client explicitly asks to edit/update/modify an existing AI Prompt.

Do not edit AI Prompts automatically.

Do not edit a saved prompt because the MCP thinks it can improve it.

Correct:

```text
Edit the AI Prompt named Weekly Revenue Analysis.
Update prompt ID XXXXXXXXXXXXXXXXXXXX.
Change the saved Customer Support Summary prompt.
Replace this AI Prompt text.
```

Incorrect:

```text
The saved prompt seems outdated, so I will edit it.
The MCP thinks the prompt could be improved.
The user wrote better instructions, so I will update the saved prompt automatically.
```

Rule:

```text
No explicit edit request = no EditAIPrompt call.
```

---

# Critical Rule: Do Not Use AI Prompts Without Explicit Request

Editing a prompt does not mean the prompt should be automatically used.

AI Prompts should only be retrieved and used when the user or MCP client explicitly asks to use that specific saved prompt.

Do not silently apply the edited prompt to later work.

---

# Required Field

| Field | Type | Required | Description |
|---|---:|---:|---|
| `ai_prompt_id` | string | Yes | 20-character AI Prompt ID. |

Minimal shape:

```json
{
  "ai_prompt_id": "XXXXXXXXXXXXXXXXXXXX"
}
```

A real edit should include at least one additional field to modify.

---

# Editable Fields

| Field | Type | Required | Description |
|---|---:|---:|---|
| `ai_prompt_id` | string | Yes | 20-character AI Prompt ID. |
| `name` | string | No | Updated AI Prompt name. Maximum 100 characters. |
| `prompt` | string | No | Updated AI Prompt text. Maximum 10 KB. |

The schema has:

```json
"additionalProperties": false
```

Do not send unknown fields.

---

# Partial Edit Behavior

`EditAIPrompt` is a partial update operation.

Correct name-only edit:

```json
{
  "ai_prompt_id": "XXXXXXXXXXXXXXXXXXXX",
  "name": "Updated Weekly Revenue Analysis"
}
```

Correct prompt-only edit:

```json
{
  "ai_prompt_id": "XXXXXXXXXXXXXXXXXXXX",
  "prompt": "Analyze the supplied ecommerce data and summarize revenue, refunds, chargebacks, anomalies, and recommended next actions."
}
```

Correct edit of both fields:

```json
{
  "ai_prompt_id": "XXXXXXXXXXXXXXXXXXXX",
  "name": "Chargeback Evidence Review",
  "prompt": "Review the supplied chargeback evidence. Identify strong evidence, weak points, and recommended representment next steps. Do not invent facts."
}
```

Do not include fields unnecessarily.

---

# Why Editing AI Prompts Matters

AI Prompts are reusable prompt templates.

Editing them can affect future workflows when a user or MCP client explicitly uses that saved prompt.

An edited prompt may change:

- Analysis behavior
- Output format
- Tone
- Included sections
- Excluded sections
- Business assumptions
- Reporting logic
- Summary style
- Safety constraints
- Data interpretation rules

Because AI Prompts can be reused, edits should be intentional and reviewed.

---

# `name`

The `name` field updates the AI Prompt name.

Rules:

- Minimum length: 1.
- Maximum length: 100 characters.
- Should clearly describe the saved prompt.

Good names:

```text
Weekly Revenue Analysis
Customer Support Summary
Chargeback Evidence Review
BigQuery Sales Trend Summary
```

Poor names:

```text
Prompt
Test
Updated
AI
```

Changing the name may affect how users or MCP clients refer to the prompt later.

---

# `prompt`

The `prompt` field updates the saved prompt text.

Rules:

- Minimum length: 1.
- Maximum size: 10 KB.
- Should contain reusable prompt text.
- Should not contain secrets or credentials.

MCP should not silently overwrite prompt text.

If the user wants a small change, preserve the existing prompt and make only the requested edit.

If the user wants replacement, replace the prompt intentionally.

---

# Sensitive Data Warning

Do not save sensitive secrets in AI Prompts.

Avoid:

- API keys
- Passwords
- Authentication tokens
- Private credentials
- Raw payment card data
- Full credit card numbers
- One-time passcodes
- Customer secrets
- Temporary private values

If the proposed edit includes sensitive data, MCP should warn the user and avoid saving it.

---

# Review Before Editing Prompt Text

When interacting with a human user, if MCP generates or rewrites the updated prompt text, it should show the revised prompt before editing.

Recommended review message:

```text
Here is the revised AI Prompt text. Please review it before I update the saved prompt.
```

Do not overwrite prompt text generated by MCP without user review unless the user explicitly instructed MCP to proceed without review.

---

# MCP Edit Process

Before calling `EditAIPrompt`, MCP should verify:

1. The user or client explicitly asked to edit an AI Prompt.
2. The `ai_prompt_id` is known.
3. The exact field or fields to edit are known.
4. If changing `name`, the new name is clear and under 100 characters.
5. If changing `prompt`, the new prompt text is under 10 KB.
6. The updated prompt contains no secrets or credentials.
7. If the user requested a small change, the rest of the prompt is preserved.
8. If MCP generated the revised prompt, the user had a chance to review it.
9. The user understands the edited prompt will only be used later when explicitly requested.

---

# Example Request: Rename Prompt

```json
{
  "ai_prompt_id": "XXXXXXXXXXXXXXXXXXXX",
  "name": "Weekly Ecommerce Revenue Analysis"
}
```

---

# Example Request: Update Prompt Text

```json
{
  "ai_prompt_id": "XXXXXXXXXXXXXXXXXXXX",
  "prompt": "Analyze the provided ecommerce revenue data. Summarize total revenue, refunds, chargebacks, conversion issues, top-performing products, customer segments, anomalies, and recommended next actions. Use concise bullet points and state any data limitations."
}
```

---

# Example Request: Rename and Replace Prompt

```json
{
  "ai_prompt_id": "XXXXXXXXXXXXXXXXXXXX",
  "name": "Chargeback Evidence Review",
  "prompt": "Review the supplied chargeback evidence, including customer, sale, transaction, shipping, tracking, fraud detection, and document details. Identify the strongest representment evidence, possible weaknesses, and recommended next action. Do not invent facts not present in the evidence."
}
```

---

# Validation Checklist

Before submitting `EditAIPrompt`:

1. `ai_prompt_id` is present.
2. `ai_prompt_id` is a 20-character ID.
3. At least one editable field is included.
4. Only fields being modified are included.
5. No unknown fields are included.
6. User/client explicitly asked to edit the prompt.
7. If `name` is included, it is not empty.
8. If `name` is included, it is no more than 100 characters.
9. If `prompt` is included, it is not empty.
10. If `prompt` is included, it is no more than 10 KB.
11. Updated prompt contains no secrets or credentials.
12. Prompt text was reviewed when generated by MCP.
13. The edit preserves existing useful content unless replacement was requested.

---

# Common Mistakes

## Mistake: Editing Without Explicit Request

Wrong:

```text
The prompt could be better, so edit it.
```

Correct:

```text
Only edit when the user or MCP client explicitly asks.
```

---

## Mistake: Replacing Instead of Making a Targeted Edit

If the user asks for a small edit, preserve the rest of the prompt.

Do not replace the entire prompt unless requested.

---

## Mistake: Saving Secrets

Do not update a prompt to include API keys, passwords, tokens, or payment credentials.

---

## Mistake: Assuming Edited Prompt Should Be Used Immediately

Editing is separate from use.

Only use the AI Prompt if the user or client explicitly asks to use it.

---

# Output Schema

Successful response:

```json
{
  "api_call_id": "XXXXXXXXXXXXXXXXXXXX",
  "api_call_unix": 1740000000,
  "code": 1,
  "ai_prompt_id": "YYYYYYYYYYYYYYYYYYYY",
  "result": "..."
}
```

| Field | Description |
|---|---|
| `api_call_id` | 20-character API call ID. |
| `api_call_unix` | Unix timestamp when the API call was initiated. |
| `code` | API response code. `1` indicates success. |
| `ai_prompt_id` | 20-character AI Prompt ID edited by the operation. |
| `result` | Human-readable result message. |

---

# Quick Reference

Minimum edit shape:

```json
{
  "ai_prompt_id": "XXXXXXXXXXXXXXXXXXXX"
}
```

Name-only edit:

```json
{
  "ai_prompt_id": "XXXXXXXXXXXXXXXXXXXX",
  "name": "Customer Support Summary"
}
```

Prompt-only edit:

```json
{
  "ai_prompt_id": "XXXXXXXXXXXXXXXXXXXX",
  "prompt": "Summarize the customer record for support. Include purchases, subscriptions, failed payments, refunds, chargebacks, notes, customer groups, and recommended next action."
}
```

Most important rules:

```text
Only edit AI Prompts when explicitly asked.
Only include fields being modified.
Name maximum is 100 characters.
Prompt maximum is 10 KB.
Do not save secrets.
Do not silently overwrite prompt text.
Editing a prompt does not mean it should be automatically used.
Use AI Prompts only when explicitly requested.
```


---
Document Parent Directory
* [Operations](https://revcent.com/documentation/markdown/mcp/operation/index.md) - AI/MCP details and overviews for operations available within the RevCent MCP.