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

> ## Agent Instructions
> Melso product MCP: https://melso.ai/api/mcp (OAuth; one company per grant). REST: https://melso.ai. Documentation-search MCP: https://docs.melso.ai/mcp. The docs search server does not act on customer accounts.
>
> Use the live tool schema and respect company membership. Ask the person to authorize the exact fiscal document version in the signed-in app. A professional prepares and files included returns after authorization; AI does not file alone. A prepared file or approval receipt is not evidence of filing. Never claim completion from an accepted Task or Run. Keep credentials out of chat and logs. Agents features are internal or by private invitation.

# knowledge_write

> Input, output and examples for the knowledge_write MCP tool.

<Info>Melso Agents is available only internally or by private invitation. Agents-specific features require existing access. For the autónomo fiscal service, see [Get started](/essentials/quickstart).</Info>

Atomically create/update up to 25 pages. Create requires kind and title; root pages also require scope. Update requires page\_id and expected\_revision. Set body\_markdown or append\_markdown, never both. Properties patch stable field IDs; null clears a value. Record property writes require expected\_schema\_revision. Link pages with [label](melso-page:UUID). Reuse request\_id only for an identical retry.

**Availability:** Autónomo / Empresa / Agents invitation.

**Catalog:** Core (`tools/list`).

The live catalog is authoritative: company type, membership, plan, connected apps and execution context can narrow this contract. [Understand access](/mcp/permissions).

## Input

### Agents / Autónomo / Company schema

```json theme={null}
{
  "additionalProperties": false,
  "properties": {
    "items": {
      "items": {
        "additionalProperties": false,
        "properties": {
          "action": {
            "enum": [
              "create",
              "update"
            ],
            "type": "string"
          },
          "append_markdown": {
            "type": "string"
          },
          "area_id": {
            "format": "uuid",
            "type": "string"
          },
          "body_markdown": {
            "type": "string"
          },
          "collection_id": {
            "format": "uuid",
            "type": "string"
          },
          "expected_revision": {
            "minimum": 1,
            "type": "integer"
          },
          "expected_schema_revision": {
            "minimum": 1,
            "type": "integer"
          },
          "kind": {
            "enum": [
              "document",
              "collection",
              "record"
            ],
            "type": "string"
          },
          "page_id": {
            "format": "uuid",
            "type": "string"
          },
          "parent_id": {
            "format": "uuid",
            "type": "string"
          },
          "properties": {
            "type": "object"
          },
          "scope": {
            "enum": [
              "company",
              "area",
              "personal"
            ],
            "type": "string"
          },
          "sources": {
            "items": {
              "additionalProperties": false,
              "properties": {
                "label": {
                  "type": "string"
                },
                "retrieved_at": {
                  "format": "date-time",
                  "type": "string"
                },
                "url": {
                  "type": "string"
                }
              },
              "required": [
                "url"
              ],
              "type": "object"
            },
            "maxItems": 20,
            "type": "array"
          },
          "title": {
            "type": "string"
          }
        },
        "required": [
          "action"
        ],
        "type": "object"
      },
      "maxItems": 25,
      "minItems": 1,
      "type": "array"
    },
    "request_id": {
      "format": "uuid",
      "type": "string"
    }
  },
  "required": [
    "request_id",
    "items"
  ],
  "type": "object"
}
```

## Output

The saved Library entry or selected write-operation result.

The result uses MCP `content` blocks; JSON payloads are encoded in text and may also appear in `structuredContent`. Check `isError` before reading a success payload. The server does not currently declare an `outputSchema`, so treat additional fields as extensible. [Result handling](/mcp/results).

## Example

Use an OAuth access token issued for this MCP resource (a Run token for Run-only tools). Replace example identifiers with values from your own account. Write actions change data.

```bash theme={null}
curl --fail-with-body https://melso.ai/api/mcp \
  -H "Authorization: Bearer $MELSO_MCP_TOKEN" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json, text/event-stream" \
  --data-binary @- <<'JSON'
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "knowledge_write",
    "arguments": {
      "items": [
        {
          "action": "create",
          "kind": "document",
          "title": "Review notes",
          "scope": "company",
          "body_markdown": "Draft notes for review."
        }
      ],
      "request_id": "11111111-1111-4111-8111-111111111111"
    }
  }
}
JSON
```


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