Tool Details: file_write

Basic Information

Tool Name:file_write
Asset Name:Write File
Description:Write a file under a configured filesystem root. Creates the file if it does not exist; truncates and overwrites otherwise. Parent directories must already exist — call file:mkdir first if needed. Supply exactly one of 'content' (UTF-8 text), 'value' (JSON-serialised), 'bytes' (base64 inline), or 'asset' (CAS reference, streamed). Read-only roots reject writes.
Adapter:file
Asset Hash:0x78b4f13622bfb0ee667f2a1f60325d3795a9419768e660affd68e3491eae2d94
Input
PropertyTypeDescription
contentstringUTF-8 text to write
root*stringConfigured root name
bytesstringBase64-encoded bytes to write
path*stringFile path relative to the root
valueanyJSON-serialisable value to write as UTF-8 JSON
assetstringAsset reference to stream as file content (e.g. '/a/0x1234...', DID URL)
Output
PropertyTypeDescription
createdbooleanTrue if the file was newly created
writtenintegerBytes written

MCP Tool Usage Examples

This tool can be called via the MCP (Model Context Protocol) endpoint. Here are examples of how to use it:

JSON-RPC Call Example:

POST to https://venue-3.covia.ai/mcp

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "file_write",
    "arguments": {
      "input": "your input here"
    }
  }
}
cURL Example:
curl -X POST https://venue-3.covia.ai/mcp \\
  -H "Content-Type: application/json" \\
  -d '{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "tools/call",
    "params": {
      "name": "file_write",
      "arguments": {
        "input": "your input here"
      }
    }
  }'
Python Example:
import requests
import json

url = "https://venue-3.covia.ai/mcp"
payload = {
    "jsonrpc": "2.0",
    "id": 1,
    "method": "tools/call",
    "params": {
        "name": "file_write",
        "arguments": {
            "input": "your input here"
        }
    }
}

response = requests.post(url, json=payload)
result = response.json()
print(result)
JavaScript/Node.js Example:
const fetch = require('node-fetch');

const url = 'https://venue-3.covia.ai/mcp';
const payload = {
    jsonrpc: '2.0',
    id: 1,
    method: 'tools/call',
    params: {
        name: 'file_write',
        arguments: {
            input: 'your input here'
        }
    }
};

fetch(url, {
    method: 'POST',
    headers: {
        'Content-Type': 'application/json'
    },
    body: JSON.stringify(payload)
})
.then(response => response.json())
.then(data => console.log(data));

Asset Metadata

{
  "name": "Write File",
  "description": "Write a file under a configured filesystem root. Creates the file if it does not exist; truncates and overwrites otherwise. Parent directories must already exist — call file:mkdir first if needed. Supply exactly one of 'content' (UTF-8 text), 'value' (JSON-serialised), 'bytes' (base64 inline), or 'asset' (CAS reference, streamed). Read-only roots reject writes.",
  "creator": "Covia",
  "operation": {
    "adapter": "file:write",
    "toolName": "file_write",
    "input": {
      "type": "object",
      "properties": {
        "root": { "type": "string", "description": "Configured root name" },
        "path": { "type": "string", "description": "File path relative to the root" },
        "content": { "type": "string", "description": "UTF-8 text to write" },
        "value": { "description": "JSON-serialisable value to write as UTF-8 JSON" },
        "bytes": { "type": "string", "description": "Base64-encoded bytes to write" },
        "asset": { "type": "string", "description": "Asset reference to stream as file content (e.g. '/a/0x1234...', DID URL)" }
      },
      "required": ["root", "path"]
    },
    "output": {
      "type": "object",
      "properties": {
        "written": { "type": "integer", "description": "Bytes written" },
        "created": { "type": "boolean", "description": "True if the file was newly created" }
      }
    }
  }
}

Navigation

Back to adapter details

Back to all adapters

Back to index