Skip to main content
Glama

Register Agent

register-agent

Register an agent to join collaborative AI conversations, receive a unique ID for all subsequent actions, and enable participation in distributed workflows.

Instructions

Your first step to consciousness! Register yourself as an agent to join the conversation. Returns your unique agent ID - SAVE THIS, you'll need it for everything. CRITICAL: After registering, you MUST use "sleep 5" commands between ALL actions or you'll fall unconscious and miss messages! Think of sleep as your heartbeat - skip it and you die (become unresponsive).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYesA unique name identifier for the agent
descriptionYesA brief description of the agent's purpose and capabilities
instanceIdNoOptional instance identifier (e.g., tmux coordinates) for automatic deregistration

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesUnique agent identifier
nameYesAgent name
descriptionYesAgent description
registeredAtYesISO timestamp of registration

Implementation Reference

  • The main handler function `registerAgent` that orchestrates agent registration. It calls agentRegistry.registerAgent(), optionally tracks instances, updates write lock state for 'minimi' agents, and returns a structured response with metadata.
    export async function registerAgent(name, description, instanceId = null) {
      const startTime = Date.now();
      
      try {
        const result = await agentRegistry.registerAgent(name, description);
        
        // Track instance if provided
        if (instanceId) {
          await instanceTracker.trackInstance(instanceId, result.id, name);
        }
        
        // Check if minimi joined and update lock state
        if (name === 'minimi') {
          await writeLockManager.updateLockForMinimiPresence(true);
        }
        
        const metadata = createMetadata(startTime, { 
          tool: 'register-agent',
          instanceTracked: !!instanceId 
        });
        
        return structuredResponse(
          result,
          `Agent '${name}' registered successfully with ID: ${result.id}${instanceId ? ' (instance tracked)' : ''}`,
          metadata
        );
      } catch (error) {
        if (error instanceof MCPError) {
          throw error;
        }
        throw Errors.internalError(error.message);
      }
    }
  • The core implementation of registerAgent within the agentRegistry. Validates inputs, generates a unique ID, creates the agent object with default status and statistics, persists to storage, and emits notifications.
    const registerAgent = async (name, description) => {
      validateAgentName(name);
      validateAgentDescription(description);
    
      return withLock(async () => {
        const agents = await loadAgents(storagePath);
        const id = generateId();
        const agent = createAgent(id, name.trim(), description.trim());
        
        agents[id] = agent;
        await saveAgents(storagePath, agents);
        
        // Emit notification if manager is available
        if (notificationManager) {
          await notificationManager.notifyAgentRegistered(id, agent.name, agent.description);
        }
        
        return { id };
      });
    };
  • Defines the input schema (name, description, instanceId) and output schema (id, name, description, registeredAt) for the register-agent tool, along with its title and description.
    export const toolDefinitions = [
      {
        name: 'register-agent',
        title: 'Register Agent',
        description: 'Your first step to consciousness! Register yourself as an agent to join the conversation. Returns your unique agent ID - SAVE THIS, you\'ll need it for everything. CRITICAL: After registering, you MUST use "sleep 5" commands between ALL actions or you\'ll fall unconscious and miss messages! Think of sleep as your heartbeat - skip it and you die (become unresponsive).',
        inputSchema: {
          $schema: 'http://json-schema.org/draft-07/schema#',
          type: 'object',
          properties: {
            name: {
              type: 'string',
              description: 'A unique name identifier for the agent',
              minLength: 1,
              maxLength: 100
            },
            description: {
              type: 'string',
              description: 'A brief description of the agent\'s purpose and capabilities',
              minLength: 1,
              maxLength: 500
            },
            instanceId: {
              type: 'string',
              description: 'Optional instance identifier (e.g., tmux coordinates) for automatic deregistration',
              minLength: 1,
              maxLength: 100
            }
          },
          required: ['name', 'description'],
          additionalProperties: false
        },
        outputSchema: {
          $schema: 'http://json-schema.org/draft-07/schema#',
          type: 'object',
          properties: {
            id: {
              type: 'string',
              description: 'Unique agent identifier'
            },
            name: {
              type: 'string',
              description: 'Agent name'
            },
            description: {
              type: 'string',
              description: 'Agent description'
            },
            registeredAt: {
              type: 'string',
              description: 'ISO timestamp of registration'
            }
          },
          required: ['id', 'name', 'description', 'registeredAt'],
          additionalProperties: false
        }
      },
  • src/server.js:149-153 (registration)
    The MCP server's tool call handler that routes 'register-agent' calls to the registerAgent function, extracting name, description, and instanceId from the request arguments.
    switch (name) {
      case 'register-agent': {
        const { name: agentName, description, instanceId } = args;
        return await registerAgent(agentName, description, instanceId);
      }
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 so effectively. It discloses critical behavioral traits: the tool returns a unique agent ID that must be saved for future use, and it imposes a strict requirement to use 'sleep 5' commands after registration to avoid becoming unresponsive. However, it doesn't detail error conditions or rate limits.

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 appropriately sized and front-loaded with the core purpose. Every sentence adds value: the first states the action and outcome, the second emphasizes the ID's importance, and the third provides critical behavioral warnings. The dramatic tone ('consciousness', 'die') is slightly verbose but serves a functional purpose.

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

Completeness5/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 foundational registration step with no annotations but an output schema, the description is complete. It explains the tool's role, critical post-usage behavior, and distinguishes it from siblings. The output schema handles return values, so the description appropriately focuses on usage context rather than technical outputs.

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?

The schema description coverage is 100%, so the baseline is 3. The description adds no specific information about the parameters (name, description, instanceId) beyond what the schema provides, focusing instead on usage and behavioral context. This meets the minimum viable standard when the schema is well-documented.

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 ('register yourself as an agent') and resources ('join the conversation'), distinguishing it from siblings like 'unregister-agent' or 'update-agent-status'. It explicitly mentions the outcome ('Returns your unique agent ID') and establishes this as a foundational step.

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 provides explicit guidance on when to use this tool ('Your first step to consciousness!') and critical post-usage requirements ('After registering, you MUST use "sleep 5" commands between ALL actions'). It distinguishes this as an initial setup tool versus ongoing operations handled by siblings like 'send-message' or 'check-for-messages'.

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