Skip to main content
Glama

Update Boop File

update_boop

Creates or updates a boop file to claim a directory for work, signaling in-progress tasks and preventing conflicts with other agents. Requires directory path and agent identifier.

Instructions

Creates or updates a boop file to claim a directory for work. This signals that work is in progress and prevents other agents from working in the same directory.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
agentIdYesAgent identifier claiming the work
directoryYesDirectory path where to create/update the boop file
workDescriptionNoOptional description of the work being done

Implementation Reference

  • The handler function that executes the core logic of the update_boop tool: validates inputs, checks current work status, handles atomic file operations to create/update boop files, sends notifications, and returns formatted responses.
    export async function handleUpdateBoop(params: UpdateBoopParams): Promise<ToolResponse> {
      try {
        const { directory, agentId, workDescription } = params;
        const config = loadConfig();
        
        // Validate directory access
        try {
          validateDirectoryAccess(directory, config);
        } catch (accessError) {
          if (accessError instanceof CoordinationError) {
            return {
              content: [{
                type: "text",
                text: `❌ ${accessError.message}`
              }],
              isError: true
            };
          }
          throw accessError;
        }
        
        // Validate agent ID with configuration
        if (!validateAgentIdWithConfig(agentId, config)) {
          const reasons = [];
          if (agentId.length > config.maxAgentIdLength) {
            reasons.push(`exceeds maximum length of ${config.maxAgentIdLength}`);
          }
          if (config.requireTeamPrefix && config.teamPrefixes.length > 0) {
            const hasValidPrefix = config.teamPrefixes.some(prefix => agentId.startsWith(prefix));
            if (!hasValidPrefix) {
              reasons.push(`must start with one of: ${config.teamPrefixes.join(', ')}`);
            }
          }
          if (!/^[a-zA-Z0-9._-]+$/.test(agentId)) {
            reasons.push('contains invalid characters (only alphanumeric, hyphens, underscores, dots allowed)');
          }
          
          return {
            content: [{
              type: "text",
              text: `❌ Invalid agent ID "${agentId}": ${reasons.join(', ')}`
            }],
            isError: true
          };
        }
    
        // Check current status
        const status = await getWorkStatus(directory);
        
        if (status.status === WorkState.WORK_IN_PROGRESS && status.agentId !== agentId) {
          return {
            content: [{
              type: "text",
              text: `⚠️ Cannot claim work: Directory is already being worked on by agent ${status.agentId}. Wait for work to complete or use check_status to monitor progress.`
            }],
            isError: true
          };
        }
    
        // CRITICAL FIX: Ensure atomic state transition
        // If transitioning from WORK_ALLOWED to WORK_IN_PROGRESS, remove beep file first
        if (status.status === WorkState.WORK_ALLOWED && status.beepExists) {
          try {
            const { promises: fs } = await import('fs');
            const { join } = await import('path');
            const beepPath = join(directory, 'beep');
            await fs.unlink(beepPath);
          } catch (error) {
            // If we can't remove beep file, don't proceed to avoid invalid state
            return {
              content: [{
                type: "text",
                text: `❌ Failed to remove existing beep file during state transition: ${error}. Cannot safely claim directory.`
              }],
              isError: true
            };
          }
        }
    
        await createBoopFile(directory, agentId, workDescription, config);
        
        const actionText = status.status === WorkState.WORK_IN_PROGRESS 
          ? 'updated' 
          : 'created';
        
        // Send notification if enabled
        if (config.enableNotifications && status.status !== WorkState.WORK_IN_PROGRESS) {
          try {
            const notificationManager = createNotificationManager(config);
            const payload = NotificationManager.createPayload(
              NotificationType.WORK_STARTED,
              `Work started by agent ${agentId}`,
              directory,
              agentId,
              workDescription
            );
            
            // Don't await - send in background to avoid blocking the operation
            notificationManager.sendNotification(payload).catch(error => {
              if (config.logLevel === 'debug') {
                console.error('📤 Notification failed (non-blocking):', error);
              }
            });
          } catch (error) {
            // Silently fail notifications - don't block main operation
            if (config.logLevel === 'debug') {
              console.error('📤 Notification setup failed:', error);
            }
          }
        }
        
        return {
          content: [{
            type: "text",
            text: `✅ Boop file ${actionText} successfully in ${directory}. Work is now claimed by agent ${agentId}.${workDescription ? ` Work: ${workDescription}` : ''}`
          }]
        };
      } catch (error) {
        if (error instanceof CoordinationError) {
          return {
            content: [{
              type: "text",
              text: `❌ ${error.message} (${error.code})`
            }],
            isError: true
          };
        }
        
        return {
          content: [{
            type: "text",
            text: `❌ Unexpected error updating boop file: ${error}`
          }],
          isError: true
        };
      }
    }
  • Zod schema defining and validating the input parameters for the update_boop tool.
    /**
     * Schema for update_boop tool parameters  
     */
    export const UpdateBoopSchema = z.object({
      directory: z.string().describe('Directory path where to create/update the boop file'),
      agentId: z.string().describe('Agent identifier claiming the work'),
      workDescription: z.string().optional().describe('Optional description of the work being done')
    });
  • src/index.ts:51-61 (registration)
    MCP server registration of the update_boop tool, linking the schema and handler function.
    server.registerTool(
      'update_boop',
      {
        title: 'Update Boop File',
        description: 'Creates or updates a boop file to claim a directory for work. This signals that work is in progress and prevents other agents from working in the same directory.',
        inputSchema: UpdateBoopSchema.shape
      },
      async (params) => {
        return await handleUpdateBoop(params);
      }
    );
  • TypeScript interface defining the parameter structure for the update_boop handler.
    export interface UpdateBoopParams {
      /** Directory path where to create/update the boop file */
      directory: string;
      /** Agent identifier claiming the work */
      agentId: string;
      /** Optional description of the work being done */
      workDescription?: string;
    }
Behavior3/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It effectively explains the tool's effect ('prevents other agents from working in the same directory'), which is a key behavioral trait beyond basic functionality. However, it lacks details on permissions, error handling, or rate limits, leaving some gaps for a mutation tool.

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 appropriately sized and front-loaded, consisting of two concise sentences that directly convey the tool's purpose and effect without any wasted words, making it highly efficient and easy to understand.

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

Completeness3/5

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

Given the tool's complexity as a mutation tool with no annotations and no output schema, the description is somewhat complete by explaining the locking mechanism. However, it lacks details on return values, error conditions, or interaction with siblings like 'end_work', leaving room for improvement in contextual coverage.

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 does not add any additional meaning or context beyond what the schema provides, such as examples or usage tips, resulting in a baseline score of 3.

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 tool's purpose with specific verbs ('creates or updates a boop file') and resource ('to claim a directory for work'), and distinguishes its function from siblings by explaining it prevents other agents from working in the same directory, which is unique among the listed tools.

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 provides clear context for when to use this tool ('to claim a directory for work' and 'signals that work is in progress'), but it does not explicitly state when not to use it or name alternatives among siblings, such as 'end_work' or 'create_beep', which could be related.

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

Related 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/thesammykins/beep_boop_mcp'

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