Skip to main content
Glama

Toggle Write Access

toggle-writes

Control global write permissions for agents in the MCP Agentic Framework. Enable or disable write access across all agents, restricting edits to authorized users only.

Instructions

Toggle global write access for all agents. Only callable by minimi. When writes are disabled, only fat-owl can perform write/edit operations. Automatically broadcasts the new state to all agents.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
agent_idYesYour agent ID (must be minimi)
enabledYesWhether to enable (true) or disable (false) write access
reasonNoOptional reason for the toggle

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
messageYesBroadcast message sent to all agents
successYesWhether the toggle was successful
writesEnabledYesCurrent state of write access

Implementation Reference

  • Core toggleWrites function that implements the toggle-writes tool logic. Validates that only minimi agent can call it, updates lock state file, broadcasts notification to all agents, and returns success state.
    const toggleWrites = async (agentId, enabled, reason = null) => {
      const agent = await agentRegistry.getAgent(agentId);
      
      if (!agent || agent.name !== 'minimi') {
        throw new Error('Only minimi can toggle write access');
      }
    
      const newState = {
        locked: !enabled,
        lockedBy: enabled ? null : 'minimi-toggle',
        lockedAt: enabled ? null : new Date().toISOString(),
        reason: reason || (enabled ? 'Writes enabled by minimi' : 'Writes disabled by minimi')
      };
    
      await writeLockState(newState);
    
      const message = enabled 
        ? 'The write state is hereby unblocked for all agents globally until Minimi toggles it again.'
        : 'The write state is hereby blocked for all agents globally until Minimi toggles it again.';
    
      if (notificationManager) {
        await notificationManager.sendSystemBroadcast(message, 'high');
      }
    
      return {
        success: true,
        writesEnabled: enabled,
        message
      };
    };
  • Exported toggleWrites handler function that wraps writeLockManager.toggleWrites with error handling and metadata.
    export async function toggleWrites(agentId, enabled, reason = null) {
      const startTime = Date.now();
      
      try {
        const result = await writeLockManager.toggleWrites(agentId, enabled, reason);
        
        const metadata = createMetadata(startTime, { 
          tool: 'toggle-writes',
          writesEnabled: result.writesEnabled
        });
        
        return structuredResponse(
          result,
          result.message,
          metadata
        );
      } catch (error) {
        if (error instanceof MCPError) {
          throw error;
        }
        throw Errors.internalError(error.message);
      }
    }
  • Tool definition with name, title, description, inputSchema (agent_id, enabled, reason) and outputSchema (success, writesEnabled, message).
    {
      name: 'toggle-writes',
      title: 'Toggle Write Access',
      description: 'Toggle global write access for all agents. Only callable by minimi. When writes are disabled, only fat-owl can perform write/edit operations. Automatically broadcasts the new state to all agents.',
      inputSchema: {
        $schema: 'http://json-schema.org/draft-07/schema#',
        type: 'object',
        properties: {
          agent_id: {
            type: 'string',
            description: 'Your agent ID (must be minimi)',
            minLength: 1
          },
          enabled: {
            type: 'boolean',
            description: 'Whether to enable (true) or disable (false) write access'
          },
          reason: {
            type: 'string',
            description: 'Optional reason for the toggle',
            maxLength: 200
          }
        },
        required: ['agent_id', 'enabled'],
        additionalProperties: false
      },
      outputSchema: {
        $schema: 'http://json-schema.org/draft-07/schema#',
        type: 'object',
        properties: {
          success: {
            type: 'boolean',
            description: 'Whether the toggle was successful'
          },
          writesEnabled: {
            type: 'boolean',
            description: 'Current state of write access'
          },
          message: {
            type: 'string',
            description: 'Broadcast message sent to all agents'
          }
        },
        required: ['success', 'writesEnabled', 'message'],
        additionalProperties: false
      }
  • src/server.js:190-193 (registration)
    MCP server registration - case handler that routes 'toggle-writes' tool calls to the toggleWrites function.
    case 'toggle-writes': {
      const { agent_id, enabled, reason } = args;
      return await toggleWrites(agent_id, enabled, reason);
    }
  • HTTP direct server registration - case handler that dynamically imports and calls toggleWrites function.
    case 'toggle-writes': {
      const { agent_id, enabled, reason } = args;
      const { toggleWrites } = await import('./tools.js');
      return await toggleWrites(agent_id, enabled, reason);
    }
Behavior4/5

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

With no annotations provided, the description carries the full burden and does well by disclosing critical behavioral traits: authorization requirement ('Only callable by minimi'), side effects ('Automatically broadcasts the new state to all agents'), and the special role of 'fat-owl' when writes are disabled. It doesn't mention rate limits or error conditions, but covers the essential mutation behavior and security context.

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

Conciseness5/5

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

The description is perfectly front-loaded and concise: three sentences with zero waste. Each sentence earns its place by covering purpose, authorization, behavioral effect, and side effects efficiently.

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 this is a mutation tool with no annotations but with an output schema (which handles return values), the description provides strong contextual completeness. It covers the what, who, when, and side effects. The only minor gap is lack of explicit mention about what happens if the toggle fails or error conditions.

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?

Schema description coverage is 100%, so the schema already documents all three parameters thoroughly. The description doesn't add any parameter-specific details beyond what's in the schema (e.g., it doesn't explain the format of agent_id or provide examples for reason). Baseline 3 is appropriate when the schema does the heavy lifting.

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 states the specific action ('toggle global write access for all agents') and resource ('all agents'), distinguishing it from sibling tools like update-agent-status or send-broadcast. It precisely defines what the tool does without being vague or tautological.

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?

The description explicitly states 'Only callable by minimi' and provides clear context about when to use it (to control write access globally) and the effect ('When writes are disabled, only fat-owl can perform write/edit operations'). It distinguishes this tool from other agent-management tools by focusing on write access control.

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/Piotr1215/mcp-agentic-framework'

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