# PDF — canonical payload contracts

Convert Markdown or HTML to a PDF or DOCX published as a temporary staging URL.

**Service id:** `pdf`  
**Docs:** [https://mcp.glc-rag.hu/guide/pdf](https://mcp.glc-rag.hu/guide/pdf)  
**Markdown docs:** [https://mcp.glc-rag.hu/guide/pdf.md](https://mcp.glc-rag.hu/guide/pdf.md)  
**MCP resource:** `docs://pdf/payload`

POST `https://mcp.glc-rag.hu/mcp`. Values below are **type slots** from the live input schema (e.g. `<string, required>`), not example data. Fill them from the user task.

RPC result wrapper: `result.structuredContent` is the object in **Output schema**. `result.isError` mirrors `structuredContent.is_error`.

## `markdown_to_pdf`

Render Markdown to PDF and publish to staging. Provide markdown string, or url / content_base64 for larger content.

**Required arguments:** _(none)_

**Request contract**

```json
{
  "jsonrpc": "2.0",
  "id": "<integer|string>",
  "method": "tools/call",
  "params": {
    "name": "markdown_to_pdf",
    "arguments": {
      "markdown": "<string, optional>",
      "url": "<string, optional>",
      "content_base64": "<string, optional>",
      "filename": "<string, optional>",
      "page_format": "<string, optional, enum A4|Letter, default 'A4'>",
      "margin_mm": "<number, optional, default 12, minimum 4, maximum 40>",
      "css": "<string, optional>"
    }
  }
}
```

**Input schema**

```json
{
  "type": "object",
  "properties": {
    "markdown": {
      "type": "string",
      "description": "Markdown source text"
    },
    "url": {
      "type": "string",
      "description": "Public or staging URL of a UTF-8 markdown/text file"
    },
    "content_base64": {
      "type": "string",
      "description": "Small markdown as base64 or data: URL"
    },
    "filename": {
      "type": "string",
      "description": "Output filename (default document.pdf)"
    },
    "page_format": {
      "type": "string",
      "enum": [
        "A4",
        "Letter"
      ],
      "default": "A4"
    },
    "margin_mm": {
      "type": "number",
      "minimum": 4,
      "maximum": 40,
      "default": 12,
      "description": "Page margin in millimeters"
    },
    "css": {
      "type": "string",
      "description": "Optional extra CSS (size-limited)"
    }
  },
  "additionalProperties": false
}
```

**Output schema** (`structuredContent` on success)

```json
{
  "type": "object",
  "properties": {
    "url": {
      "type": "string"
    },
    "bytes": {
      "type": "integer"
    },
    "filename": {
      "type": "string"
    },
    "content_type": {
      "type": "string"
    }
  },
  "additionalProperties": true,
  "required": [
    "url"
  ]
}
```

**Error object**

```json
{
  "type": "object",
  "required": [
    "error",
    "is_error"
  ],
  "properties": {
    "error": {
      "type": "string"
    },
    "is_error": {
      "type": "boolean",
      "const": true
    }
  },
  "additionalProperties": true
}
```

## `html_to_pdf`

Render HTML (document or fragment) to PDF and publish to staging. Provide html string, or url / content_base64. Does not navigate to live pages.

**Required arguments:** _(none)_

**Request contract**

```json
{
  "jsonrpc": "2.0",
  "id": "<integer|string>",
  "method": "tools/call",
  "params": {
    "name": "html_to_pdf",
    "arguments": {
      "html": "<string, optional>",
      "url": "<string, optional>",
      "content_base64": "<string, optional>",
      "filename": "<string, optional>",
      "page_format": "<string, optional, enum A4|Letter, default 'A4'>",
      "margin_mm": "<number, optional, default 12, minimum 4, maximum 40>",
      "css": "<string, optional>"
    }
  }
}
```

**Input schema**

```json
{
  "type": "object",
  "properties": {
    "html": {
      "type": "string",
      "description": "HTML document or fragment"
    },
    "url": {
      "type": "string",
      "description": "Public or staging URL of a UTF-8 HTML file (downloaded, not navigated)"
    },
    "content_base64": {
      "type": "string",
      "description": "Small HTML as base64 or data: URL"
    },
    "filename": {
      "type": "string",
      "description": "Output filename (default document.pdf)"
    },
    "page_format": {
      "type": "string",
      "enum": [
        "A4",
        "Letter"
      ],
      "default": "A4"
    },
    "margin_mm": {
      "type": "number",
      "minimum": 4,
      "maximum": 40,
      "default": 12,
      "description": "Page margin in millimeters"
    },
    "css": {
      "type": "string",
      "description": "Optional extra CSS (size-limited)"
    }
  },
  "additionalProperties": false
}
```

**Output schema** (`structuredContent` on success)

```json
{
  "type": "object",
  "properties": {
    "url": {
      "type": "string"
    },
    "bytes": {
      "type": "integer"
    },
    "filename": {
      "type": "string"
    },
    "content_type": {
      "type": "string"
    }
  },
  "additionalProperties": true,
  "required": [
    "url"
  ]
}
```

**Error object**

```json
{
  "type": "object",
  "required": [
    "error",
    "is_error"
  ],
  "properties": {
    "error": {
      "type": "string"
    },
    "is_error": {
      "type": "boolean",
      "const": true
    }
  },
  "additionalProperties": true
}
```

## `markdown_to_docx`

Render Markdown to a formatted DOCX (headings, lists, tables, code, links) and publish to staging. Provide markdown string, or url / content_base64.

**Required arguments:** _(none)_

**Request contract**

```json
{
  "jsonrpc": "2.0",
  "id": "<integer|string>",
  "method": "tools/call",
  "params": {
    "name": "markdown_to_docx",
    "arguments": {
      "markdown": "<string, optional>",
      "url": "<string, optional>",
      "content_base64": "<string, optional>",
      "filename": "<string, optional>",
      "page_format": "<string, optional, enum A4|Letter, default 'A4'>",
      "margin_mm": "<number, optional, default 12, minimum 4, maximum 40>"
    }
  }
}
```

**Input schema**

```json
{
  "type": "object",
  "properties": {
    "markdown": {
      "type": "string",
      "description": "Markdown source text"
    },
    "url": {
      "type": "string",
      "description": "Public or staging URL of a UTF-8 markdown/text file"
    },
    "content_base64": {
      "type": "string",
      "description": "Small markdown as base64 or data: URL"
    },
    "filename": {
      "type": "string",
      "description": "Output filename (default document.docx)"
    },
    "page_format": {
      "type": "string",
      "enum": [
        "A4",
        "Letter"
      ],
      "default": "A4",
      "description": "Word page size"
    },
    "margin_mm": {
      "type": "number",
      "minimum": 4,
      "maximum": 40,
      "default": 12,
      "description": "Page margin in millimeters"
    }
  },
  "additionalProperties": false
}
```

**Output schema** (`structuredContent` on success)

```json
{
  "type": "object",
  "properties": {
    "url": {
      "type": "string"
    },
    "bytes": {
      "type": "integer"
    },
    "filename": {
      "type": "string"
    },
    "content_type": {
      "type": "string"
    }
  },
  "additionalProperties": true,
  "required": [
    "url"
  ]
}
```

**Error object**

```json
{
  "type": "object",
  "required": [
    "error",
    "is_error"
  ],
  "properties": {
    "error": {
      "type": "string"
    },
    "is_error": {
      "type": "boolean",
      "const": true
    }
  },
  "additionalProperties": true
}
```

## `html_to_docx`

Render HTML (document or fragment) to a formatted DOCX and publish to staging. Maps headings, paragraphs, lists, tables, pre/code, blockquotes, links. Does not navigate to live pages; css is ignored.

**Required arguments:** _(none)_

**Request contract**

```json
{
  "jsonrpc": "2.0",
  "id": "<integer|string>",
  "method": "tools/call",
  "params": {
    "name": "html_to_docx",
    "arguments": {
      "html": "<string, optional>",
      "url": "<string, optional>",
      "content_base64": "<string, optional>",
      "filename": "<string, optional>",
      "page_format": "<string, optional, enum A4|Letter, default 'A4'>",
      "margin_mm": "<number, optional, default 12, minimum 4, maximum 40>"
    }
  }
}
```

**Input schema**

```json
{
  "type": "object",
  "properties": {
    "html": {
      "type": "string",
      "description": "HTML document or fragment"
    },
    "url": {
      "type": "string",
      "description": "Public or staging URL of a UTF-8 HTML file (downloaded, not navigated)"
    },
    "content_base64": {
      "type": "string",
      "description": "Small HTML as base64 or data: URL"
    },
    "filename": {
      "type": "string",
      "description": "Output filename (default document.docx)"
    },
    "page_format": {
      "type": "string",
      "enum": [
        "A4",
        "Letter"
      ],
      "default": "A4",
      "description": "Word page size"
    },
    "margin_mm": {
      "type": "number",
      "minimum": 4,
      "maximum": 40,
      "default": 12,
      "description": "Page margin in millimeters"
    }
  },
  "additionalProperties": false
}
```

**Output schema** (`structuredContent` on success)

```json
{
  "type": "object",
  "properties": {
    "url": {
      "type": "string"
    },
    "bytes": {
      "type": "integer"
    },
    "filename": {
      "type": "string"
    },
    "content_type": {
      "type": "string"
    }
  },
  "additionalProperties": true,
  "required": [
    "url"
  ]
}
```

**Error object**

```json
{
  "type": "object",
  "required": [
    "error",
    "is_error"
  ],
  "properties": {
    "error": {
      "type": "string"
    },
    "is_error": {
      "type": "boolean",
      "const": true
    }
  },
  "additionalProperties": true
}
```

## `pdf_status`

PDF/DOCX service health, Chromium path, and limits.

**Required arguments:** _(none)_

**Request contract**

```json
{
  "jsonrpc": "2.0",
  "id": "<integer|string>",
  "method": "tools/call",
  "params": {
    "name": "pdf_status",
    "arguments": {}
  }
}
```

**Input schema**

```json
{
  "type": "object",
  "properties": {},
  "additionalProperties": false
}
```

**Output schema** (`structuredContent` on success)

```json
{
  "type": "object",
  "properties": {
    "ok": {
      "type": "boolean"
    }
  },
  "additionalProperties": true,
  "required": [
    "ok"
  ]
}
```

**Error object**

```json
{
  "type": "object",
  "required": [
    "error",
    "is_error"
  ],
  "properties": {
    "error": {
      "type": "string"
    },
    "is_error": {
      "type": "boolean",
      "const": true
    }
  },
  "additionalProperties": true
}
```
