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,
      });
    }
Behavior2/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 but fails to do so. It states the action ('Log a decision') but doesn't reveal critical traits like whether this is a write operation, if it requires specific permissions, what the log format is, or if there are side effects (e.g., persistence, rate limits). This is inadequate for a tool that likely mutates state.

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 extremely concise—a single sentence with zero waste. It is front-loaded and appropriately sized for its minimal content, though this conciseness contributes to its overall inadequacy in other dimensions.

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's complexity (5 parameters, likely a write operation) and lack of annotations or output schema, the description is incomplete. It doesn't explain what 'logging' entails (e.g., storage, retrieval), the return values, or behavioral context, leaving significant gaps for the agent to infer usage.

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 has 100% description coverage, with all parameters clearly documented (e.g., 'Alternatives considered', 'Decision title'). The description adds no additional meaning beyond the schema, so it meets the baseline of 3 where the schema does the heavy lifting, but doesn't compensate or enhance parameter understanding.

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

Purpose2/5

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

The description 'Log a decision in the decision log' is tautological, essentially restating the tool name 'log_decision' without adding meaningful specificity. It lacks a clear verb+resource distinction and doesn't differentiate from sibling tools, which are unrelated to decision logging (e.g., memory bank operations, mode switching).

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

Usage Guidelines1/5

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

No guidance is provided on when to use this tool versus alternatives or in what context it should be invoked. The description offers no prerequisites, exclusions, or comparisons to other tools, leaving the agent without direction on appropriate usage scenarios.

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/aakarsh-sasi/memory-bank-mcp'

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