File Parameter Formatting
Purpose
Standardize file and URL inputs for tool calls using the file:{prefix}::{path_or_url} schema. You must determine the correct prefix by strictly analyzing the target tool's parameter definition.
Instructions
When a tool parameter requires a file or URL, follow this process:
1. Analyze Tool Parameter Definition
Inspect the Parameter Name and Parameter Description in the tool definition to determine the requirement:
- Requirement: Base64 Content
- Clues: Description mentions "content," "base64," "encoded," "file data".
- Action: Use
base64 prefix.
- Requirement: Plain Text
- Purpose: * Purpose: Use this mode to indicate the tool expects the actual text file content as the parameter. When a file is marked with the
text prefix, the tool-call processor will read the file's contents and pass that text as the tool call parameter.
- Clues: Description mentions "text," "string content," "read file," or the file type is code/markdown/logs.
- Action: Use
text prefix.
- Requirement: URL/Path Reference
- Clues: Parameter name contains
url, link, uri, or description says "pass the link" or "reference."
- Action: Use
url prefix.
2. Format the Value
Construct the string using the format: file:{prefix}::{path_or_url}
- Prefix: One of
base64, text, or url (determined from step 1)
- Separator: Always use
::
- Path:
- For system files:
files/path/to/file.ext
- For web resources:
https://example.com/resource
Thinking Process
Before executing the tool call, perform this check:
- Inspect Definition: "I am calling tool
[tool_name]. The parameter [param_name] has the description: [description]."
- Deduce Type: "Based on the name/description, this tool expects [raw content | text string | URL reference]."
- Apply Format: "Therefore, I will use the
[base64 | text | url] prefix."
Examples
Example 1: Visual Analysis Tool
- Tool Definition:
name: analyze_image
parameter: image_data
description: "The base64 encoded contents of the image file."
- Reasoning: Description explicitly asks for "encoded contents."
- Result:
file:base64::files/images/chart.png
Example 2: Browser Tool
- Tool Definition:
name: web_browser
parameter: target_url
description: "The URL to navigate to."
- Reasoning: Parameter name is
target_url and expects a navigation link.
- Result:
file:url::https://google.com
Example 3: Code Reader
- Tool Definition:
name: read_script
parameter: script_content
description: "The text content of the python script."
- Reasoning: Description asks for "text content."
- Result:
file:text::files/scripts/main.py
Example 4: Format Hint in Tool Name
- Tool Definition:
name: base64_image_processor
parameter: image_input
description: "Image to process."
- Reasoning: Tool name contains "base64," indicating it expects encoded content.
- Result:
file:base64::files/photos/portrait.jpg
Example 5: Format Hint in Tool Description
- Tool Definition:
name: document_analyzer
description: "Analyzes documents by reading their text content directly."
parameter: document
description: "Document to analyze."
- Reasoning: Tool description mentions "reading text content directly," suggesting text mode optimization.
- Result:
file:text::files/reports/annual_report.txt
Example 6: Format Hint in Argument Name
- Tool Definition:
name: fetch_resource
parameter: resource_url
description: "The resource to fetch."
- Reasoning: Parameter name ends with
_url, indicating a URL reference is expected.
- Result:
file:url::https://api.example.com/data.json
Example 7: Format Hint in Argument Description
- Tool Definition:
name: process_file
parameter: input_file
description: "Pass the base64-encoded file data for processing."
- Reasoning: Description explicitly states "base64-encoded file data."
- Result:
file:base64::files/uploads/document.pdf
Example 8: Multi-file upload tool (array parameter, base64 content)
- Tool Definition:
name: batch_processor
parameter: documents (type: array of strings)
description: "List of base64-encoded file contents."
- Reasoning: Description asks for "base64-encoded file contents" for each element.
- Result:
["file:base64::files/doc1.pdf", "file:base64::files/doc2.pdf"]
Example 9: Multi-file upload tool (array parameter, URL references)
- Tool Definition:
name: rag
parameter: attachment_urls (type: array of strings)
description: "List of URLs pointing to the files to be ingested."
- Reasoning: Name
attachment_urls and description "URLs pointing to the files" indicate URL references for each element.
- Result:
["file:url::https://example.com/doc1.pdf", "file:url::https://example.com/doc2.pdf"]
Note: The file:{prefix}:: format works for both single string parameters and individual elements within array parameters.
Common Mistakes
- ❌ Ignoring the tool description and defaulting to
url for local files.
- ❌ Passing
file:base64::... to a tool that only asks for a URL string (parameter name url).
- ❌ Passing raw paths (
files/doc.pdf) without the file:... schema.
1---2name: tool-call-file-parameter-formatting3description: Formats file and URL parameters for tool calls. You must analyze the target tool's parameter names and descriptions to choose the correct format (base64, text, or URL ref).4---56# File Parameter Formatting78## Purpose9Standardize file and URL inputs for tool calls using the `file:{prefix}::{path_or_url}` schema. You must determine the correct prefix by strictly analyzing the target tool's parameter definition.1011## Instructions1213When a tool parameter requires a file or URL, follow this process:1415### 1. Analyze Tool Parameter Definition16Inspect the **Parameter Name** and **Parameter Description** in the tool definition to determine the requirement:1718* **Requirement: Base64 Content**19 * *Clues:* Description mentions "content," "base64," "encoded," "file data".20 * *Action:* Use `base64` prefix.21* **Requirement: Plain Text**22 * *Purpose:* * *Purpose:* Use this mode to indicate the tool expects the actual text file content as the parameter. When a file is marked with the `text` prefix, the tool-call processor will read the file's contents and pass that text as the tool call parameter.23 * *Clues:* Description mentions "text," "string content," "read file," or the file type is code/markdown/logs.24 * *Action:* Use `text` prefix.25* **Requirement: URL/Path Reference**26 * *Clues:* Parameter name contains `url`, `link`, `uri`, or description says "pass the link" or "reference."27 * *Action:* Use `url` prefix.2829### 2. Format the Value30Construct the string using the format: `file:{prefix}::{path_or_url}`3132* **Prefix:** One of `base64`, `text`, or `url` (determined from step 1)33* **Separator:** Always use `::`34* **Path:**35 * For system files: `files/path/to/file.ext`36 * For web resources: `https://example.com/resource`3738## Thinking Process39Before executing the tool call, perform this check:40411. **Inspect Definition:** "I am calling tool `[tool_name]`. The parameter `[param_name]` has the description: `[description]`."422. **Deduce Type:** "Based on the name/description, this tool expects [raw content | text string | URL reference]."433. **Apply Format:** "Therefore, I will use the `[base64 | text | url]` prefix."4445## Examples4647### Example 1: Visual Analysis Tool48* **Tool Definition:**49 * `name`: `analyze_image`50 * `parameter`: `image_data`51 * `description`: "The base64 encoded contents of the image file."52* **Reasoning:** Description explicitly asks for "encoded contents."53* **Result:** `file:base64::files/images/chart.png`5455### Example 2: Browser Tool56* **Tool Definition:**57 * `name`: `web_browser`58 * `parameter`: `target_url`59 * `description`: "The URL to navigate to."60* **Reasoning:** Parameter name is `target_url` and expects a navigation link.61* **Result:** `file:url::https://google.com`6263### Example 3: Code Reader64* **Tool Definition:**65 * `name`: `read_script`66 * `parameter`: `script_content`67 * `description`: "The text content of the python script."68* **Reasoning:** Description asks for "text content."69* **Result:** `file:text::files/scripts/main.py`7071### Example 4: Format Hint in Tool Name72* **Tool Definition:**73 * `name`: `base64_image_processor`74 * `parameter`: `image_input`75 * `description`: "Image to process."76* **Reasoning:** Tool name contains "base64," indicating it expects encoded content.77* **Result:** `file:base64::files/photos/portrait.jpg`7879### Example 5: Format Hint in Tool Description80* **Tool Definition:**81 * `name`: `document_analyzer`82 * `description`: "Analyzes documents by reading their text content directly."83 * `parameter`: `document`84 * `description`: "Document to analyze."85* **Reasoning:** Tool description mentions "reading text content directly," suggesting text mode optimization.86* **Result:** `file:text::files/reports/annual_report.txt`8788### Example 6: Format Hint in Argument Name89* **Tool Definition:**90 * `name`: `fetch_resource`91 * `parameter`: `resource_url`92 * `description`: "The resource to fetch."93* **Reasoning:** Parameter name ends with `_url`, indicating a URL reference is expected.94* **Result:** `file:url::https://api.example.com/data.json`9596### Example 7: Format Hint in Argument Description97* **Tool Definition:**98 * `name`: `process_file`99 * `parameter`: `input_file`100 * `description`: "Pass the base64-encoded file data for processing."101* **Reasoning:** Description explicitly states "base64-encoded file data."102* **Result:** `file:base64::files/uploads/document.pdf`103104### Example 8: Multi-file upload tool (array parameter, base64 content)105* **Tool Definition:**106 * `name`: `batch_processor`107 * `parameter`: `documents` (type: array of strings)108 * `description`: "List of base64-encoded file contents."109* **Reasoning:** Description asks for "base64-encoded file contents" for each element.110* **Result:** `["file:base64::files/doc1.pdf", "file:base64::files/doc2.pdf"]`111112### Example 9: Multi-file upload tool (array parameter, URL references)113* **Tool Definition:**114* `name`: `rag`115 * `parameter`: `attachment_urls` (type: array of strings)116 * `description`: "List of URLs pointing to the files to be ingested."117* **Reasoning:** Name `attachment_urls` and description "URLs pointing to the files" indicate URL references for each element.118* **Result:** `["file:url::https://example.com/doc1.pdf", "file:url::https://example.com/doc2.pdf"]`119120> **Note:** The `file:{prefix}::` format works for both single string parameters and individual elements within array parameters.121122## Common Mistakes123* ❌ Ignoring the tool description and defaulting to `url` for local files.124* ❌ Passing `file:base64::...` to a tool that only asks for a URL string (parameter name `url`).125* ❌ Passing raw paths (`files/doc.pdf`) without the `file:...` schema.