Skip to main content
Glama

complete_handoff

Destructive

Finalize sequential delegation handoffs by recording verification outcomes including acceptance, rejection, or abortion status with performance metrics.

Instructions

Complete a sequential delegation handoff and record verification outcomes

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
handoffIdYes
outcomeYes
resultContextNo
attemptsNo
violationCountNo
tokenEstimateNo
latencyMsNo
summaryNo

Implementation Reference

  • The core logic of the complete_handoff tool, which validates the outcome, checks for an active handoff, optionally runs a verification loop, and writes the delegation completion event.
    function completeHandoff(params = {}) {
      const outcome = String(params.outcome || '').trim().toLowerCase();
      if (!HANDOFF_OUTCOMES.includes(outcome)) {
        throw createDelegationError(`Unsupported handoff outcome '${params.outcome}'`, 400);
      }
    
      const events = readDelegationEvents();
      const active = deriveActiveHandoffs(events).byHandoffId.get(params.handoffId);
      if (!active) {
        throw createDelegationError(`No active handoff found for '${params.handoffId}'`, 404);
      }
    
      const summary = normalizeText(params.summary);
      const resultContext = normalizeText(params.resultContext);
      const missingRequiredEvidence = outcome !== 'aborted' && !summary && !resultContext;
      let verification = null;
    
      if (outcome !== 'aborted' && resultContext) {
        verification = getVerificationLoopModule().runVerificationLoop({
          context: resultContext,
          tags: unique([
            'delegation',
            active.intentId ? `intent:${active.intentId}` : null,
            active.delegateProfile ? `delegate:${active.delegateProfile}` : null,
          ]),
          partnerProfile: active.partnerProfile || null,
          maxRetries: 0,
        });
      }
    
      const verificationAccepted = verification ? verification.accepted : null;
      const negativeOutcome = outcome !== 'accepted' || verificationAccepted === false || missingRequiredEvidence;
      const diagnosis = negativeOutcome
        ? buildDelegationDiagnosis(active, {
          outcome,
          reasonCode: missingRequiredEvidence ? 'missing_required_evidence' : null,
          verification,
        })
        : null;
    
      if (diagnosis && (!verification || !verification.persistedDiagnosis)) {
        getFeedbackLoopModule().appendDiagnosticRecord({
          source: 'delegation_runtime',
          step: diagnosis.criticalFailureStep || 'handoff_completion',
          context: resultContext || summary || active.context || '',
          diagnosis,
          metadata: {
            handoffId: active.handoffId,
            intentId: active.intentId,
            delegateProfile: active.delegateProfile,
            outcome,
          },
        });
      }
    
      if (missingRequiredEvidence) {
        promoteDelegationFailure('missing_required_evidence', {
          intentId: active.intentId,
          delegateProfile: active.delegateProfile,
        });
      }
    
      const { DELEGATION_LOG_PATH } = getDelegationPaths();
      const event = {
        eventType: 'completed',
        handoffId: active.handoffId,
        taskKey: active.taskKey,
        intentId: active.intentId,
        delegateProfile: active.delegateProfile,
        mcpProfile: active.mcpProfile,
        partnerProfile: active.partnerProfile,
        outcome,
        summary: summary || null,
        resultContext: resultContext || null,
        attempts: Number.isFinite(Number(params.attempts)) ? Number(params.attempts) : 1,
  • Tool definition and schema registration for complete_handoff.
    destructiveTool({
      name: 'complete_handoff',
      description: 'Complete a sequential delegation handoff and record verification outcomes',
      inputSchema: {
        type: 'object',
        required: ['handoffId', 'outcome'],
        properties: {
          handoffId: { type: 'string' },
          outcome: { type: 'string', enum: ['accepted', 'rejected', 'aborted'] },
          resultContext: { type: 'string' },
          attempts: { type: 'number' },
          violationCount: { type: 'number' },
          tokenEstimate: { type: 'number' },
          latencyMs: { type: 'number' },
          summary: { type: 'string' },
        },
      },
    }),
    readOnlyTool({
  • MCP server request handler route for 'complete_handoff'.
    case 'complete_handoff':
      return toTextResult(completeHandoff({
Behavior3/5

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

The annotation 'destructiveHint: true' already indicates this is a mutation operation, which the description aligns with by implying state change ('complete'). The description adds minimal context about recording outcomes but lacks details on side effects, permissions, or error handling. No contradiction with annotations exists, but the description doesn't significantly enhance behavioral understanding beyond the annotation.

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 a single, efficient sentence with zero wasted words, clearly front-loading the core purpose. Every part of the sentence contributes directly to understanding the tool's function, making it optimally concise and well-structured.

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

Completeness2/5

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

Given the complexity of 8 parameters with no schema descriptions, no output schema, and minimal annotations, the description is inadequate. It doesn't explain parameter meanings, return values, or behavioral nuances like error cases or side effects, leaving significant gaps for a tool with this level of detail.

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

Parameters2/5

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

With 0% schema description coverage for 8 parameters, the description fails to compensate by explaining any parameters. It mentions 'verification outcomes' but doesn't map to specific parameters like 'outcome' or 'resultContext'. This leaves most parameters undocumented, falling short of the baseline needed for low schema coverage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('complete') and resource ('sequential delegation handoff') with the specific purpose of recording verification outcomes. It distinguishes from siblings like 'start_handoff' and 'session_handoff' by focusing on completion rather than initiation or session-level operations. However, it doesn't explicitly differentiate from all siblings, keeping it at 4 rather than 5.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives like 'start_handoff' or 'session_handoff', nor does it mention prerequisites or exclusions. It implies usage after a handoff has been initiated but offers no explicit context for selection among sibling tools.

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/IgorGanapolsky/mcp-memory-gateway'

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