Skip to main content
Glama

lock_files

Lock files before modifying them to prevent conflicts with other agents and avoid lost changes or merge conflicts in multi-agent projects.

Instructions

CRITICAL: Lock files before modifying them to prevent conflicts with other agents.

MANDATORY: Always lock files BEFORE making changes. This prevents:

  • Multiple agents editing the same file simultaneously

  • Lost changes and merge conflicts

  • Race conditions in multi-agent environments

WHEN TO USE:

  • Before editing any existing file

  • Before creating files in shared directories

  • Before refactoring code that spans multiple files

  • When you plan to modify files over an extended period

WORKFLOW:

  1. lock_files() - Lock the files you plan to modify (THIS STEP)

  2. Make your changes

  3. log_change() - Log the changes made

  4. unlock_files() - Release the locks when done

CONFLICT HANDLING: If files are already locked by another agent, you'll receive conflict information including which agent has the lock and when it expires. You should either:

  • Wait for the lock to be released

  • Coordinate with the other agent

  • Work on different files first

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
filesYesList of file paths to lock (required) - e.g., ["src/auth.ts", "src/utils.ts"]
reasonYesClear reason for locking (required) - e.g., "Implementing JWT authentication"
agent_idYesYour agent_id from register_agent() (required)
project_idYesProject ID from create_project() (required)
expected_duration_minutesNoHow long you expect to hold the locks (default: 60)
Behavior4/5

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

Since no annotations are provided, the description carries the full burden and largely succeeds. It discloses conflict behavior, lock expiration, and coordination options, but could add more detail on lock release semantics or success responses.

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?

Well-structured with headers and bullet lists, but some redundancy exists (e.g., CRITICAL and MANDATORY both emphasize importance, and prevention bullets repeat). Length is justified by the criticality of correct usage and the detailed workflow guidance.

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?

Covers purpose, prerequisites (via schema), workflow, and conflict handling effectively. Since there is no output schema, the description doesn't explain return values, but it does mention receiving conflict information. Missing explicit success return details but overall complete for a locking tool.

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

Parameters3/5

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

All five parameters are fully documented in the input schema with descriptions and examples. The description adds no new parameter-specific information, but schema coverage is 100%, so baseline 3 is appropriate.

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 explicitly states the tool's function: locking files before modification to prevent conflicts. It clearly differentiates from sibling tools like unlock_files and get_locked_files by defining its unique role in the workflow.

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

Usage Guidelines5/5

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

Provides explicit when-to-use scenarios (editing existing files, shared directories, multi-file refactors, extended modifications). Includes a step-by-step workflow, naming lock_files as step 1 and unlock_files as step 4, plus conflict handling guidance with alternatives.

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/siddiquesahabaj/CoordMCP'

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