cache_set
Store a string value under a key in the cache. Values expire automatically after 1 hour.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
key | string | Yes | The cache key under which the value is stored. |
value | string | Yes | The string value to store. Serialize complex values (e.g. to JSON) before calling this tool. |
Response
| Field | Type | Description |
|---|---|---|
success | boolean | Always true on success — confirms the write completed without error. |
Example
{
"key": "my-session-data",
"value": "{\"step\":3,\"items\":[\"a\",\"b\"]}"
}
Result:
{
"success": true
}
Errors
Each failure carries a precise code in the response. Argument-schema and server errors are JSON-RPC protocol errors; a rejected value is returned as a tool result with isError: true (so the agent can read the code and self-correct).
| Code | When | Delivered as |
|---|---|---|
invalid_arguments | The key or value argument is missing or the wrong type. | protocol error (invalid_params) |
invalid_cache_key | The key is empty or contains a disallowed character such as :. | tool error (isError) |
value_too_large | The value exceeds the maximum size of 256 KB. | tool error (isError) |
tool_not_configured | The cache backend is not available on this server. | tool error (isError) |
internal_error | An unexpected error occurred while accessing the cache. | protocol error (internal_error) |
method_not_found | The tool isn't available to your credential. | protocol error (method_not_found) |
Notes
- Cache entries are scoped to your credential: a personal credential's entries are private to you, while an organization credential shares one cache across the organization. Keys never cross that boundary.
- Keys must not contain
:. - Only string values are accepted. Serialize objects or arrays to JSON before storing them.
- Writing to an existing key overwrites the previous value and resets the expiry to 1 hour.
- Values are limited to 256 KB. Larger values must be split across multiple keys.