Skip to main content
Glama

log_decision

Record and document decisions in a structured format, including title, context, alternatives, and consequences, for centralized knowledge management on the MCP server.

Instructions

Log a decision in the decision log

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
alternativesNoAlternatives considered
consequencesNoConsequences of the decision
contextYesDecision context
decisionYesThe decision made
titleYesDecision title

Implementation Reference

  • The main handler function for the 'log_decision' tool. It calls ProgressTracker.logDecision to log the decision and also tracks progress.
    export async function handleLogDecision(
      progressTracker: ProgressTracker,
      decision: {
        title: string;
        context: string;
        decision: string;
        alternatives?: string[] | string;
        consequences?: string[] | string;
      }
    ) {
      try {
        await progressTracker.logDecision(decision);
    
        // Also track this as progress
        await progressTracker.trackProgress('Decision Made', {
          description: decision.title,
        });
    
        return {
          content: [
            {
              type: 'text',
              text: `Decision logged: ${decision.title}`,
            },
          ],
        };
      } catch (error) {
        return {
          content: [
            {
              type: 'text',
              text: `Error logging decision: ${error}`,
            },
          ],
          isError: true,
        };
      }
    }
  • Core helper method in ProgressTracker that implements the logic to append a formatted decision entry to 'decision-log.md'.
      async logDecision(decision: Decision): Promise<void> {
        const decisionLogPath = path.join(this.memoryBankDir, 'decision-log.md');
        
        try {
          let decisionLogContent = await FileUtils.readFile(decisionLogPath);
          
          const timestamp = new Date().toISOString().split('T')[0];
          const time = new Date().toLocaleTimeString();
          const userId = decision.userId || this.userId;
          const formattedUserId = this.formatUserId(userId);
          
          // Format alternatives and consequences
          const alternatives = Array.isArray(decision.alternatives) 
            ? decision.alternatives.map(alt => `  - ${alt}`).join('\n') 
            : decision.alternatives || 'None';
            
          const consequences = Array.isArray(decision.consequences) 
            ? decision.consequences.map(cons => `  - ${cons}`).join('\n') 
            : decision.consequences || 'None';
          
          const newDecision = `
    ## ${decision.title}
    - **Date:** ${timestamp} ${time}
    - **Author:** ${formattedUserId}
    - **Context:** ${decision.context}
    - **Decision:** ${decision.decision}
    - **Alternatives Considered:** 
    ${Array.isArray(decision.alternatives) ? alternatives : `  - ${alternatives}`}
    - **Consequences:** 
    ${Array.isArray(decision.consequences) ? consequences : `  - ${consequences}`}
    `;
          
          // Add the new decision to the end of the file
          decisionLogContent += newDecision;
          
          await FileUtils.writeFile(decisionLogPath, decisionLogContent);
        } catch (error) {
          console.error(`Error logging decision: ${error}`);
          throw new Error(`Failed to log decision: ${error}`);
        }
      }
  • Input schema for the log_decision tool defining the expected parameters.
    inputSchema: {
      type: 'object',
      properties: {
        title: {
          type: 'string',
          description: 'Decision title',
        },
        context: {
          type: 'string',
          description: 'Decision context',
        },
        decision: {
          type: 'string',
          description: 'The decision made',
        },
        alternatives: {
          type: 'array',
          items: {
            type: 'string',
          },
          description: 'Alternatives considered',
        },
        consequences: {
          type: 'array',
          items: {
            type: 'string',
          },
          description: 'Consequences of the decision',
        },
      },
      required: ['title', 'context', 'decision'],
    },
  • Registration of the log_decision tool with name, description, and schema reference.
    export const decisionTools = [
      {
        name: 'log_decision',
        description: 'Log a decision in the decision log',
        inputSchema: {
          type: 'object',
          properties: {
            title: {
              type: 'string',
              description: 'Decision title',
            },
            context: {
              type: 'string',
              description: 'Decision context',
            },
            decision: {
              type: 'string',
              description: 'The decision made',
            },
            alternatives: {
              type: 'array',
              items: {
                type: 'string',
              },
              description: 'Alternatives considered',
            },
            consequences: {
              type: 'array',
              items: {
                type: 'string',
              },
              description: 'Consequences of the decision',
            },
          },
          required: ['title', 'context', 'decision'],
        },
      },
    ];
  • Registration of all tools including decisionTools in the MCP server's ListToolsRequestHandler.
    server.setRequestHandler(ListToolsRequestSchema, async () => ({
      tools: [
        ...coreTools,
        ...progressTools,
        ...contextTools,
        ...decisionTools,
        ...modeTools,
      ],
    }));
  • Dispatch handler in the main tool call switch statement that validates arguments and calls handleLogDecision.
    case 'log_decision': {
      const progressTracker = getProgressTracker();
      if (!progressTracker) {
        return {
          content: [
            {
              type: 'text',
              text: 'Memory Bank not found. Use initialize_memory_bank to create one.',
            },
          ],
          isError: true,
        };
      }
    
      const { title, context, decision, alternatives, consequences } = request.params.arguments as {
        title: string;
        context: string;
        decision: string;
        alternatives?: string[] | string;
        consequences?: string[] | string;
      };
      if (!title || !context || !decision) {
        throw new McpError(
          ErrorCode.InvalidParams,
          'Title, context, and decision are required'
        );
      }
      return handleLogDecision(progressTracker, {
        title,
        context,
        decision,
        alternatives,
        consequences,
      });
    }

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

C2.9/5.0
Behavior2/5

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

No annotations are provided, so the description must describe behavioral traits. It fails to disclose any side effects, persistence behavior, or required state. The minimal description offers no transparency beyond the basic action.

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 extremely concise at 6 words, with no wasted content. It front-loads the core purpose. However, it is so brief that it may sacrifice clarity for brevity.

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 tool has 5 parameters, 3 required, and no output schema, the description is insufficiently complete. It does not explain the tool's integration, output, or any contextual details needed to use it effectively.

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 input schema covers all 5 parameters with descriptions, achieving 100% coverage. The tool description adds no additional meaning or examples beyond what the schema provides, so it meets the baseline without adding value.

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 indicates the action (log) and resource (decision/decision log), distinguishing it from sibling tools like add_progress_entry or add_session_note. However, it could be more specific about the scope and purpose of the decision log.

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 compared to alternatives, nor does it mention prerequisites, limitations, or exclusions. The agent is left to infer usage from context.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Deploy Server

Other Tools

Related Tools