Skip to main content
Glama

record_outcome

Logs positive, negative, or neutral outcomes for instincts to track performance and adjust confidence levels with optional explanatory notes.

Instructions

Record a positive, negative, or neutral outcome for an instinct

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesInstinct ID
resultYesOutcome result
deltaYesConfidence change (e.g. +0.05 or -0.1)
noteNoOptional note explaining the outcome

Implementation Reference

  • Implementation of the recordOutcome method which updates an instinct's confidence and logs the outcome.
    async recordOutcome(
      id: string,
      result: 'positive' | 'negative' | 'neutral',
      delta: number,
      note?: string,
    ): Promise<Instinct> {
      const entry = await this.find(id);
      if (!entry) throw new Error(`Instinct not found: ${id}`);
    
      const { file, instinctFile, instinct } = entry;
    
      const outcome: OutcomeEntry = {
        timestamp: new Date().toISOString(),
        result,
        delta_confidence: delta,
        note,
      };
      instinct.outcome_log.push(outcome);
      instinct.confidence = Math.max(0, Math.min(1, instinct.confidence + delta));
      instinct.updated_at = new Date().toISOString();
    
      instinctFile.instincts[id] = instinct;
      await this.loader.save(file, instinctFile);
    
      return instinct;
    }
  • MCP tool handler case for 'record_outcome' that invokes Registry.recordOutcome.
    case 'record_outcome': {
      const id = String(args?.['id'] ?? '');
      const result = String(args?.['result'] ?? '') as 'positive' | 'negative' | 'neutral';
      const delta = Number(args?.['delta'] ?? 0);
      const note = args?.['note'] ? String(args['note']) : undefined;
      if (!id || !result) return { content: [{ type: 'text', text: 'Error: id and result are required' }] };
      try {
        const instinct = await registry.recordOutcome(id, result, delta, note);
        return { content: [{ type: 'text', text: JSON.stringify({ id, result, new_confidence: instinct.confidence, outcomes: instinct.outcome_log.length }, null, 2) }] };
      } catch (e) {
        return { content: [{ type: 'text', text: `Error: ${e instanceof Error ? e.message : String(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/doobidoo/MCP-Context-Provider'

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