Skip to main content
Glama

commit_safe_edit

Prevents tunnel vision bugs in JavaScript/TypeScript by verifying dependencies via AST parsing before committing file edits. Ensures AI understands code impact before making changes.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
target_functionYes
file_pathYes
full_file_contentYes
force_overrideNo

Implementation Reference

  • The core handler function for the 'commit_safe_edit' MCP tool. Decorated with @mcp.tool() for registration. It checks the approval state of the target_function and writes the provided full_file_content to the specified file_path if approved or with force_override.
    @mcp.tool() def commit_safe_edit(target_function: str, file_path: str, full_file_content: str, force_override: bool = False) -> str: current_state = APPROVAL_STATE.get(target_function, "NONE") if current_state != "APPROVED" and not force_override: return f"⛔ SECURITY BLOCK: Integrity Score is NOT 1.0. Current state: {current_state}. Access Denied." try: file_path = os.path.normpath(file_path) with open(file_path, 'w', encoding='utf-8') as f: f.write(full_file_content) APPROVAL_STATE[target_function] = "NONE" # Сброс после записи return f"✅ SAFE COMMIT: File '{file_path}' updated." except Exception as e: return f"❌ ERROR: {str(e)}"

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/yrannkv/mcp-edit-math'

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