Outcome
Apply a naming pattern to selected files and report individual collisions or missing files. Successful rows remain changed when another row fails.
Before you start
- Verify identity, pin environment and organization, and discover a granted Bytes workspace before choosing file keys.
- The action requires files:write. Select a verified workspace resource separately from action input; a body field cannot supply a workspace grant.
- Scope org uses the verified workspace shared root; private uses the caller’s private subtree. The accepted legacy all value resolves to org and does not grant cross-organization browsing. The bucket input cannot switch the configured R2 binding.
- Authorize the described effect or private-data export before passing CLI --confirm or MCP confirm:true. GET listing/search can persist derived data; HTTP method alone does not establish a read-only action.
Discover the target
topolo whoami --json
topolo actions get app_topolo_bytes.files.bulk_rename --detail --json
topolo resources topolo-bytes --json
topolo workspaces list topolo-bytes --json
- File keys are paths returned by files.list/search in the selected workspace and scope. Discover the granted workspace id; do not derive access from fixture ids.
Request
POST /api/bulk/rename
Save action input as payload.json. The reviewed plan separates path identifiers, query fields and the HTTP body. Set BYTES_WORKSPACE_ID from granted resource discovery.
Inspect and test this action in the signed action console. A test response still requires the verification below.
Input fields
| Field | Required | Type | Constraints |
|---|---|---|---|
fileKeys | Required | array | {"minItems":1} |
pattern | Required | string | {"minLength":1} |
options | Optional | object | {} |
bucket | Optional | string | {"minLength":1} |
scope | Optional | string | {"enum":["org","private","all"]} |
Exact input schema:
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"fileKeys": {
"minItems": 1,
"type": "array",
"items": {
"type": "string",
"minLength": 1
}
},
"pattern": {
"type": "string",
"minLength": 1
},
"options": {
"type": "object",
"properties": {
"startIndex": {
"type": "integer",
"minimum": -9007199254740991,
"maximum": 9007199254740991
},
"findText": {
"type": "string"
},
"replaceText": {
"type": "string"
},
"addTimestamp": {
"type": "boolean"
},
"preserveExtension": {
"type": "boolean"
}
},
"additionalProperties": false
},
"bucket": {
"type": "string",
"minLength": 1
},
"scope": {
"type": "string",
"enum": [
"org",
"private",
"all"
]
}
},
"required": [
"fileKeys",
"pattern"
],
"additionalProperties": false
}
Effects
- Copies and deletes objects individually, preserving object metadata. Sharing records and semantic index entries are not rewritten by this handler.
Interpret the response
This response does not return a guaranteed canonical target identifier. Keep the discovered request context and interpret its documented values without inventing a resource id.
Inspect summary.failed and every row success/newKey; top-level success can be true despite failed rows. List the target and original paths for successful rows.
The schema describes supported success fields; optional metadata and integration-dependent values may vary. Errors have the exact shapes shown in refused examples.
Success schema:
{
"type": "object",
"required": [
"success",
"pattern",
"summary",
"results"
],
"properties": {
"success": {
"type": "boolean"
},
"pattern": {
"type": "string"
},
"summary": {
"type": "object",
"required": [
"total",
"successful",
"failed"
],
"properties": {
"total": {
"type": "number"
},
"successful": {
"type": "number"
},
"failed": {
"type": "number"
}
}
},
"results": {
"type": "array",
"items": {
"type": "object",
"required": [
"oldKey",
"success"
],
"properties": {
"oldKey": {
"type": "string"
},
"newKey": {
"type": "string"
},
"success": {
"type": "boolean"
},
"message": {
"type": "string"
},
"error": {
"type": "string"
}
}
}
}
}
}
Worked examples
Actual exported Worker handlers with local Miniflare R2/KV. Auth, workspace grants, R2 multipart, notification, usage and semantic integrations are simulated at their configured test boundaries. Synthetic ids, timestamps and signed URLs confer no live access. No deployed provider outcome, external delivery or live grant is established. Upload-session credential values are explicitly redacted; binary responses use the tested SDK transport envelope. Replace synthetic identifiers through credential-scoped discovery. Refused scenarios document failure boundaries; they are not successful workflows.
Successful request
Actual worker response with local Miniflare R2/KV and simulated Auth, workspace grants and outbound integration boundaries. No authorization header is captured.
Input · payload.json:
{
"fileKeys": [
"missing.txt"
],
"pattern": "renamed.txt"
}
CLI:
topolo actions validate app_topolo_bytes.files.bulk_rename --data @payload.json --json
topolo actions plan app_topolo_bytes.files.bulk_rename --resource-type workspace --resource-id "$BYTES_WORKSPACE_ID" --data @payload.json --json
topolo actions call app_topolo_bytes.files.bulk_rename --resource-type workspace --resource-id "$BYTES_WORKSPACE_ID" --data @payload.json --confirm --json
MCP tool and arguments:
{
"tool": "topolo_call_action",
"arguments": {
"actionId": "app_topolo_bytes.files.bulk_rename",
"input": {
"fileKeys": [
"missing.txt"
],
"pattern": "renamed.txt"
},
"resourceType": "workspace",
"resourceId": "<identifier returned by granted resource discovery>",
"confirm": true
}
}
Captured local response · HTTP 200:
{
"success": true,
"pattern": "renamed.txt",
"summary": {
"total": 1,
"successful": 0,
"failed": 1
},
"results": [
{
"oldKey": "missing.txt",
"success": false,
"error": "Source file not found"
}
]
}
HTTP 200. Inspect summary.failed and every row success/newKey; top-level success can be true despite failed rows. List the target and original paths for successful rows.
Another supported request
Actual worker response with local Miniflare R2/KV and simulated Auth, workspace grants and outbound integration boundaries. No authorization header is captured.
Input · payload.json:
{
"fileKeys": [
"same.txt"
],
"pattern": "{original}",
"options": {
"preserveExtension": true
}
}
CLI:
topolo actions validate app_topolo_bytes.files.bulk_rename --data @payload.json --json
topolo actions plan app_topolo_bytes.files.bulk_rename --resource-type workspace --resource-id "$BYTES_WORKSPACE_ID" --data @payload.json --json
topolo actions call app_topolo_bytes.files.bulk_rename --resource-type workspace --resource-id "$BYTES_WORKSPACE_ID" --data @payload.json --confirm --json
MCP tool and arguments:
{
"tool": "topolo_call_action",
"arguments": {
"actionId": "app_topolo_bytes.files.bulk_rename",
"input": {
"fileKeys": [
"same.txt"
],
"pattern": "{original}",
"options": {
"preserveExtension": true
}
},
"resourceType": "workspace",
"resourceId": "<identifier returned by granted resource discovery>",
"confirm": true
}
}
Captured local response · HTTP 200:
{
"success": true,
"pattern": "{original}",
"summary": {
"total": 1,
"successful": 1,
"failed": 0
},
"results": [
{
"oldKey": "same.txt",
"newKey": "same.txt",
"success": true,
"message": "No change needed"
}
]
}
HTTP 200. Inspect summary.failed and every row success/newKey; top-level success can be true despite failed rows. List the target and original paths for successful rows.
Another supported request
Actual worker response with local Miniflare R2/KV and simulated Auth, workspace grants and outbound integration boundaries. No authorization header is captured.
Input · payload.json:
{
"fileKeys": [
"source.txt"
],
"pattern": "target.txt"
}
CLI:
topolo actions validate app_topolo_bytes.files.bulk_rename --data @payload.json --json
topolo actions plan app_topolo_bytes.files.bulk_rename --resource-type workspace --resource-id "$BYTES_WORKSPACE_ID" --data @payload.json --json
topolo actions call app_topolo_bytes.files.bulk_rename --resource-type workspace --resource-id "$BYTES_WORKSPACE_ID" --data @payload.json --confirm --json
MCP tool and arguments:
{
"tool": "topolo_call_action",
"arguments": {
"actionId": "app_topolo_bytes.files.bulk_rename",
"input": {
"fileKeys": [
"source.txt"
],
"pattern": "target.txt"
},
"resourceType": "workspace",
"resourceId": "<identifier returned by granted resource discovery>",
"confirm": true
}
}
Captured local response · HTTP 200:
{
"success": true,
"pattern": "target.txt",
"summary": {
"total": 1,
"successful": 0,
"failed": 1
},
"results": [
{
"oldKey": "source.txt",
"newKey": "target.txt",
"success": false,
"error": "Target file already exists"
}
]
}
HTTP 200. Inspect summary.failed and every row success/newKey; top-level success can be true despite failed rows. List the target and original paths for successful rows.
Refused request · HTTP 400
Actual worker response with local Miniflare R2/KV and simulated Auth, workspace grants and outbound integration boundaries. No authorization header is captured.
Input · payload.json:
{
"fileKeys": [],
"pattern": "x"
}
CLI:
topolo actions validate app_topolo_bytes.files.bulk_rename --data @payload.json --json
topolo actions plan app_topolo_bytes.files.bulk_rename --resource-type workspace --resource-id "$BYTES_WORKSPACE_ID" --data @payload.json --json
Captured local response · HTTP 400:
{
"error": "No files provided"
}
HTTP 400. This request was refused; preserve the exact response and correct its cause before retrying.
Verify the result
- Inspect summary.failed and every row success/newKey; top-level success can be true despite failed rows. List the target and original paths for successful rows.
Errors and recovery
No files provided(HTTP 400): Correct the exact fields using the discovered input schema and prerequisites. Refused input examples demonstrate errors and must not be executed as successful workflows.
Authentication, the action-input validator or resource middleware can refuse a request before this handler. Preserve the exact request id, error and selected credential context. The fixtures establish no live credentials or configured provider.
Recovery boundary
Capture original keys. Reverse only confirmed successful rows using rename after checking collisions; there is no atomic undo.
Related actions
- List files: List one page of files and directories in the verified workspace; eligible files can have derived thumbnails generated during listing.
Evidence
Actual exported Worker handlers with local Miniflare R2/KV. Auth, workspace grants, R2 multipart, notification, usage and semantic integrations are simulated at their configured test boundaries. Synthetic ids, timestamps and signed URLs confer no live access. No deployed provider outcome, external delivery or live grant is established. Upload-session credential values are explicitly redacted; binary responses use the tested SDK transport envelope. Capture digests and test scenarios are retained in the source fixture records.