> ## 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_files

> Input, output and examples for the knowledge_files 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>

Prepare an upload with request\_id, page\_id, property\_id, expected\_revision, expected\_schema\_revision, filename, content\_type and size\_bytes (up to 100 MiB). PUT bytes to upload.path on this server with X-Knowledge-Upload-Token: upload.token, then save the ready file ID using knowledge\_write. Files fields hold up to 25 IDs. Get reads metadata for page\_id and ids; download through the authenticated file endpoint with page\_id. Removing an ID preserves its history. Omit property\_id and the expected versions to attach a PNG, JPEG, GIF or WebP image (up to 10 MiB) to the page body, then reference the ready file ID as !\[]\(melso-file:\<file id>) in body\_markdown.

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

**Catalog:** Advanced (`tools_search`, then `tools_call`).

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": {
    "action": {
      "enum": [
        "prepare",
        "get"
      ],
      "type": "string"
    },
    "content_type": {
      "type": "string"
    },
    "expected_revision": {
      "minimum": 1,
      "type": "integer"
    },
    "expected_schema_revision": {
      "minimum": 1,
      "type": "integer"
    },
    "filename": {
      "type": "string"
    },
    "ids": {
      "items": {
        "format": "uuid",
        "type": "string"
      },
      "maxItems": 25,
      "type": "array"
    },
    "page_id": {
      "format": "uuid",
      "type": "string"
    },
    "property_id": {
      "format": "uuid",
      "type": "string"
    },
    "request_id": {
      "format": "uuid",
      "type": "string"
    },
    "size_bytes": {
      "maximum": 104857600,
      "minimum": 1,
      "type": "integer"
    }
  },
  "required": [
    "action",
    "page_id"
  ],
  "type": "object"
}
```

## Output

File metadata, attachment changes, or the selected file-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.

First discover `knowledge_files` with `tools_search` and confirm that the live schema permits these arguments.

```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": "tools_call",
    "arguments": {
      "name": "knowledge_files",
      "arguments": {
        "action": "get",
        "page_id": "11111111-1111-4111-8111-111111111111",
        "ids": [
          "11111111-1111-4111-8111-111111111111"
        ]
      }
    }
  }
}
JSON
```


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