Skip to main content
Glama
Cohexa-ai

Agent Coherence — Stale Write Guard (FS)

Official

swg_write_cas

Compare and set file content atomically, preventing stale overwrites by requiring the expected version; returns a typed conflict if version mismatches, enabling safe retry.

Instructions

Concurrent same-key write via compare-and-set. You read (swg_read returns the version comparand; swg_reacquire does NOT — it is for swg_write recovery), MERGE, then call swg_write_cas(path, expected_version, new_content). Stale-write-rejected: if a peer committed since your read, the CAS is a TYPED CONFLICT (reason=version_mismatch, current_version returned) — NOT an auto-merge; re-read at current_version, re-merge, and retry. The per-session conflict counter bounds only a COOPERATING agent (one session, stops on retryable=false); it is NOT livelock-proof against a fresh session or one that ignores retryable=false. SINGLE-HOST only. Out of guarantee and NOT detected in v1: writers on different hosts or across a synced/network mount, divergent-history reconciliation, semantic correctness, server-enforced auto-merge.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYes
new_contentYes
expected_versionYes
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

The description transparently discloses the tool's behavior: it rejects stale writes with a typed conflict (version_mismatch) and returns current_version, it does not auto-merge, and it has retry logic bounded by a per-session counter but not livelock-proof. It also documents critical limitations: single-host only, undetected issues for multi-host or network mounts. Annotations only indicate non-read-only (readOnlyHint=false), so the description provides extensive additional behavioral context.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is relatively long but well-structured: it starts with the core purpose, then explains the usage flow, conflict handling, and limitations. Every sentence provides useful information, but could be slightly condensed without losing clarity. The front-loading is effective.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (CAS, conflict resolution, single-host constraint), the description covers most essential aspects: how to use, conflict response, retry guidance, and limitations. It lacks explicit return value documentation (no output schema), but implies the conflict response includes current_version. The distinction from siblings is clear.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

With 0% schema description coverage, the description must compensate. It explains that 'expected_version' comes from swg_read (not swg_reacquire) and 'new_content' is the merged result. 'path' is not elaborated, but its purpose is clear from the schema. The description adds meaningful context for two of three parameters, enhancing understanding beyond the bare schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly identifies the tool as a compare-and-set write operation for concurrent same-key updates. It explains the CAS pattern (read, merge, write with expected_version) and distinguishes from swg_write (non-CAS) and swg_reacquire (recovery only). The verb 'write' and resource 'shared file' with CAS semantics are specific.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description explicitly states when to use the tool (after reading and merging) and how to handle conflicts (re-read, re-merge, retry). It warns that swg_reacquire should not be used to get the version for CAS. It also notes the single-host limitation and the cooperative agent assumption. However, it does not explicitly list alternative tools for different scenarios, though siblings are given.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Cohexa-ai/agent-coherence'

If you have feedback or need assistance with the MCP directory API, please join our Discord server