# Drafts

## Get Draft

`TOOL discourse_get_draft`

Retrieve a specific draft by key. Returns JSON with draft_key, sequence, and parsed data (title, reply, categoryId, tags, action).

Authentication: no security requirement declared for this operation.

Parameters:

- `draft_key` (argument, string, required) - Draft key (e.g., "new_topic", "topic_123", "new_private_message")
  Type: string
  
  Draft key (e.g., "new_topic", "topic_123", "new_private_message")
  
  minLength: 1
  
  maxLength: 40

- `sequence` (argument, integer, optional) - Expected sequence number (optional)
  Type: integer
  
  Expected sequence number (optional)
  
  minimum: 0

Declared MCP annotations:

```json
{
  "readOnlyHint": true,
  "destructiveHint": false,
  "idempotentHint": true,
  "openWorldHint": true
}
```

## Examples

### JSON-RPC

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "discourse_get_draft",
    "arguments": {
        "draft_key": "string",
        "sequence": 0
      }
  }
}
```

### TypeScript

```typescript
const result = await client.callTool({
  "name": "discourse_get_draft",
  "arguments": {
    "draft_key": "string",
    "sequence": 0
  }
});
```

### Python

```python
result = await session.call_tool("discourse_get_draft", arguments={
  "draft_key": "string",
  "sequence": 0
})
```


## Create/Save Draft

`TOOL discourse_save_draft`

Create or update a draft. Returns JSON with draft_key and new sequence number.

Authentication: no security requirement declared for this operation.

Parameters:

- `draft_key` (argument, string, required) - Draft key: "new_topic" for new topics, "topic_<id>" for replies (e.g., "topic_123")
  Type: string
  
  Draft key: "new_topic" for new topics, "topic_<id>" for replies (e.g., "topic_123")
  
  minLength: 1
  
  maxLength: 40

- `reply` (argument, string, required) - The draft content/body text
  Type: string
  
  The draft content/body text
  
  minLength: 1
  
  maxLength: 50000

- `title` (argument, string, optional) - Topic title (required for new_topic drafts)
  Type: string
  
  Topic title (required for new_topic drafts)
  
  minLength: 1
  
  maxLength: 300

- `category_id` (argument, integer, optional) - Category ID for the topic
  Type: integer
  
  Category ID for the topic
  
  exclusiveMinimum: 0

- `tags` (argument, Array<string>, optional) - Array of tag names
  Type: Array<string>
  
  Array of tag names
  
  maxItems: 10
  
  Items:
    Type: string
    
    minLength: 1
    
    maxLength: 100

- `sequence` (argument, integer, optional) - Current sequence number (use 0 for new drafts, or the sequence from get for updates)
  Type: integer
  
  Current sequence number (use 0 for new drafts, or the sequence from get for updates)
  
  default: 0
  
  minimum: 0

- `action` (argument, string, optional) - Draft action type (defaults based on draft_key)
  Type: string
  
  Draft action type (defaults based on draft_key)
  
  enum: ["createTopic","reply","edit","privateMessage"]

## Examples

### JSON-RPC

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "discourse_save_draft",
    "arguments": {
        "draft_key": "string",
        "reply": "string",
        "title": "string",
        "category_id": 0,
        "tags": [
          "string"
        ],
        "sequence": 0,
        "action": "createTopic"
      }
  }
}
```

### TypeScript

```typescript
const result = await client.callTool({
  "name": "discourse_save_draft",
  "arguments": {
    "draft_key": "string",
    "reply": "string",
    "title": "string",
    "category_id": 0,
    "tags": [
      "string"
    ],
    "sequence": 0,
    "action": "createTopic"
  }
});
```

### Python

```python
result = await session.call_tool("discourse_save_draft", arguments={
  "draft_key": "string",
  "reply": "string",
  "title": "string",
  "category_id": 0,
  "tags": [
    "string"
  ],
  "sequence": 0,
  "action": "createTopic"
})
```


## Delete Draft

`TOOL discourse_delete_draft`

Delete a draft by key. Requires current sequence number to prevent conflicts.

Authentication: no security requirement declared for this operation.

Parameters:

- `draft_key` (argument, string, required) - Draft key to delete
  Type: string
  
  Draft key to delete
  
  minLength: 1
  
  maxLength: 40

- `sequence` (argument, integer, required) - Current sequence number (required for deletion)
  Type: integer
  
  Current sequence number (required for deletion)
  
  minimum: 0

## Examples

### JSON-RPC

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "discourse_delete_draft",
    "arguments": {
        "draft_key": "string",
        "sequence": 0
      }
  }
}
```

### TypeScript

```typescript
const result = await client.callTool({
  "name": "discourse_delete_draft",
  "arguments": {
    "draft_key": "string",
    "sequence": 0
  }
});
```

### Python

```python
result = await session.call_tool("discourse_delete_draft", arguments={
  "draft_key": "string",
  "sequence": 0
})
```
