update_resource
Edit an existing resource: change its label and/or replace its content. Address it by its
path — set team for a team resource. The path itself cannot be changed. Fails if no
such resource exists in the target space.
With a credential that represents a user, omitting team targets that user's space. A team must
be bound to the credential and the credential must be allowed to manage it; a userless
organization credential must name such a team.
Only the fields you provide change; everything you omit is left as-is. To replace content,
first read the resource and send its version as expected_version. If another write has
changed the content, the update fails with resource_conflict; re-read and reconcile your
changes before retrying. Do not substitute a newer version without reviewing its content.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
path | string | Yes | The resource to update, addressed by its path. The path itself cannot be changed. |
team | string | No | The team that owns it. Omit to target the represented user's space. |
name | string | No | Replace the human-readable label. |
content | string | No | Replace the content. Provide alongside content_encoding for binary content. |
content_type | string | No | MIME type for the new content. Only used when content is given; defaults to the existing type. |
content_encoding | string | No | Encoding of content: utf8 (default) or base64. Only used when content is given. |
expected_version | integer | With content | The positive integer version of the content your replacement is based on. Required when replacing content; sending it without new content is rejected. A changed version causes resource_conflict. |
Response
| Field | Type | Description |
|---|---|---|
path | string | The resource path. |
id | string | The resource's identifier. |
version | integer | The resource's version after the update. |
Example
{
"path": "docs/readme.md",
"name": "Getting started guide",
"content": "# Getting started (updated)\n...",
"expected_version": 1
}
Result:
{
"path": "docs/readme.md",
"id": "018f...c2a1",
"version": 2
}
Errors
Each failure carries a precise code in the response. A domain rejection — a not-found, a limit, or a permission denial — is returned as a tool result with isError: true, so the agent can read the code and self-correct; malformed arguments and server faults are JSON-RPC protocol errors.
| Code | Cause | Delivered as |
|---|---|---|
resource_not_found | No resource with that path exists in the target space. | tool error (isError) |
resource_conflict | The content changed since your base version was read or while the call was waiting to write. Re-read and reconcile your changes before retrying. | tool error (isError) |
invalid_content_encoding | content_encoding is not utf8 or base64. | tool error (isError) |
invalid_base64 | content_encoding is base64 but the content isn't valid base64. | tool error (isError) |
invalid_content_type | content_type is not a valid MIME type. | tool error (isError) |
content_too_large | The content is larger than the per-call limit — use the dashboard instead. | tool error (isError) |
storage_limit_reached | Your plan's storage limit has been reached. | tool error (isError) |
team_not_found | No team with that name is bound to this credential. | tool error (isError) |
forbidden | Your credential isn't permitted to update resources. | tool error (isError) |
personal_cannot_address_team | You used a team/ prefix (or team field) with a personal credential. | tool error (isError) |
no_personal_space | This credential has no personal space — address a team instead. | tool error (isError) |
expected_version_requires_content | expected_version was given without also replacing content. | tool error (isError) |
missing_required_argument | Replacing content requires expected_version. | protocol error (invalid_params) |
invalid_arguments | The arguments do not match the schema, or expected_version is not a positive integer. | protocol error (invalid_params) |
internal_error | An unexpected error occurred. | protocol error (internal_error) |
Notes
- The path is the resource's identity and cannot be changed — to "rename" a path, create a new resource and delete the old one.
- Updating a resource counts as one tool call against your plan's tool-invocation allowance.