upload_file
Upload files for compliance rules with automatic format validation and correction. Supports JSON, YAML, CSV, XML, and TOML, returning a file URL for rule configuration.
Instructions
Upload file content and return file URL for use in rules.
ENHANCED FILE UPLOAD PROCESS:
Automatically detects file format from filename and content
Validates and fixes common formatting issues for JSON, YAML, TOML, CSV, XML
Accepts JSON arrays in various formats: raw, single-line, multi-line, or escaped (auto-formatted).
Normalizes CSV delimiters and whitespace
Reformats content with proper indentation/structure
No user preview required - validation happens automatically
Returns detailed validation results and file URL
SUPPORTED INPUT FORMATS:
Raw JSON: {"key": "value"} or [{"key": "value"}]
Escaped JSON: "{"key": "value"}"
Complex escaped: "[{"repository":"name","owner":"org"}]"
Standard strings for other formats (YAML, TOML, CSV, XML)
AUTOMATIC FORMAT PROCESSING:
JSON: Detects escaped strings, unescapes, validates syntax, reformats with indentation
Raw JSON objects/arrays: Automatically converts to proper JSON string format
YAML: Validates structure, reformats with proper indentation
TOML: Validates sections and key-value pairs, reformats
CSV: Detects delimiter, strips cell whitespace, normalizes format
XML: Validates well-formed structure
Other formats: Pass through as-is
VALIDATION RESULTS:
Returns success/failure status with detailed error messages
Provides format-specific validation feedback
Indicates if content was automatically reformatted
Includes file metadata (size, format, etc.)
Args:
rule_name: Descriptive name for the rule (same across all rule inputs)
file_name: Name of the file to upload
content: File content (text or base64 encoded)
CRITICAL: Must be stringified if JSON content
content_encoding: Encoding of the content (utf-8, base64)
Returns: Dict containing upload results: { success: bool, file_url: str, filename: str, unique_filename: str, file_id: str, file_format: str, content_size: int, validation_status: str, was_formatted: bool, message: str, error: Optional[str] }
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| rule_name | Yes | ||
| file_name | Yes | ||
| content | Yes | ||
| content_encoding | No | utf-8 |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||