{
  "id": "storage.export",
  "object": "tool",
  "name": "Export to storage",
  "summary": "Deliver files to your storage.",
  "description": "Writes files to a storage connection. Name them with a path template: {name} (file name), {stem} (name without extension), {ext}, {date} (YYYY-MM-DD, UTC) and {job} (this run's id), e.g. exports/{date}/{stem}.pdf. When a file is already there it can be overwritten, skipped, or renamed with a -1, -2… suffix. Returns the paths written and their sizes.",
  "category": "files",
  "hosted_by": "Opentools",
  "runtime": "worker",
  "side_effects": true,
  "status": "live",
  "credits": 1,
  "price": "$0.0010",
  "providers": [
    {
      "id": "opentools",
      "name": "Opentools",
      "price": "$0.0010"
    }
  ],
  "mcp_name": "storage_export",
  "input_schema": {
    "type": "object",
    "properties": {
      "connection": {
        "type": "string",
        "minLength": 1,
        "maxLength": 64,
        "description": "A connection id or name from storage.connections. Connections are added in the app or with POST /v1/connections"
      },
      "file_ids": {
        "description": "Ids of files from an upload or a tool's output",
        "maxItems": 100,
        "type": "array",
        "items": {
          "type": "string",
          "format": "uuid",
          "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
        }
      },
      "files": {
        "description": "Files to send, as file refs",
        "maxItems": 100,
        "type": "array",
        "items": {
          "anyOf": [
            {
              "type": "object",
              "properties": {
                "url": {
                  "type": "string",
                  "format": "uri",
                  "description": "Public http(s) URL of the file"
                }
              },
              "required": [
                "url"
              ]
            },
            {
              "type": "object",
              "properties": {
                "file_id": {
                  "type": "string",
                  "format": "uuid",
                  "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
                  "description": "An id returned by POST /v1/files"
                }
              },
              "required": [
                "file_id"
              ]
            },
            {
              "type": "object",
              "properties": {
                "base64": {
                  "type": "string",
                  "description": "Base64-encoded file bytes (up to 10 MB)"
                },
                "name": {
                  "type": "string",
                  "description": "File name, e.g. invoice.pdf"
                },
                "content_type": {
                  "type": "string"
                }
              },
              "required": [
                "base64",
                "name"
              ]
            },
            {
              "type": "object",
              "properties": {
                "connection": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "A storage connection id or name (see storage.connections)"
                },
                "path": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 1024,
                  "description": "Path of the file in that connection, e.g. reports/q3.pdf"
                }
              },
              "required": [
                "connection",
                "path"
              ]
            }
          ],
          "x-file": true,
          "description": "A file: { url }, { file_id }, { base64, name } or { connection, path } from connected storage"
        }
      },
      "path": {
        "default": "{name}",
        "description": "Path template. A trailing / means a folder: exports/ is exports/{name}",
        "type": "string",
        "minLength": 1,
        "maxLength": 1024
      },
      "overwrite": {
        "default": "rename",
        "description": "What to do when a file already exists at the path",
        "type": "string",
        "enum": [
          "overwrite",
          "skip",
          "rename"
        ]
      }
    },
    "required": [
      "connection"
    ]
  },
  "kind": "tool"
}