Skip to main content
Glama

prioritize_memory

Read-onlyIdempotent

Prioritize AI development memories by importance to focus on critical decisions, code changes, blockers, and next steps for current tasks.

Instructions

중요한 거|우선순위|prioritize|important|what matters|priority - Prioritize memories by importance

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
currentTaskYesCurrent task description
criticalDecisionsNoList of critical decisions made
codeChangesNoImportant code changes
blockersNoCurrent blockers or issues
nextStepsNoPlanned next steps

Implementation Reference

  • The core handler function that executes the prioritize_memory tool. It calculates priority scores for memories based on content analysis, current task relevance, critical decisions, code changes, and blockers, then updates priorities and returns top 20 prioritized memories.
    export async function prioritizeMemory(args: {
      currentTask: string;
      criticalDecisions?: string[];
      codeChanges?: string[];
      blockers?: string[];
      nextSteps?: string[]
    }): Promise<ToolResult> {
      const { currentTask, criticalDecisions = [], codeChanges = [], blockers = [], nextSteps = [] } = args;
    
      try {
        const mm = MemoryManager.getInstance();
        const allMemories = mm.list();
        const prioritizedMemories: Array<{ memory: MemoryItem; priority: number; reason: string }> = [];
    
        for (const memory of allMemories) {
          let priority = 0;
          let reason = '';
    
          // Analyze importance based on content
          if (memory.value.includes('error') || memory.value.includes('Error')) {
            priority = 0.9;
            reason = 'error info';
          } else if (memory.value.includes('decision') || memory.value.includes('Decision')) {
            priority = 0.8;
            reason = 'decision';
          } else if (memory.value.includes('code') || memory.value.includes('function')) {
            priority = 0.7;
            reason = 'code-related';
          } else if (memory.category === 'context') {
            priority = 0.6;
            reason = 'context';
          } else if (memory.category === 'project') {
            priority = 0.7;
            reason = 'project';
          } else {
            priority = 0.5;
            reason = 'general';
          }
    
          // Boost priority for memories related to current task
          if (memory.value.toLowerCase().includes(currentTask.toLowerCase())) {
            priority += 0.2;
            reason += ' +task';
          }
    
          // Boost priority for critical decisions
          for (const decision of criticalDecisions) {
            if (memory.value.toLowerCase().includes(decision.toLowerCase())) {
              priority += 0.15;
              reason += ' +critical';
              break;
            }
          }
    
          // Boost priority for code changes
          for (const change of codeChanges) {
            if (memory.value.toLowerCase().includes(change.toLowerCase())) {
              priority += 0.1;
              reason += ' +change';
              break;
            }
          }
    
          // Boost priority for blockers
          for (const blocker of blockers) {
            if (memory.value.toLowerCase().includes(blocker.toLowerCase())) {
              priority += 0.25;
              reason += ' +blocker';
              break;
            }
          }
    
          // Cap priority at 1.0
          priority = Math.min(1.0, priority);
    
          if (priority >= 0.6) {
            prioritizedMemories.push({ memory, priority, reason });
    
            // Update priority in database
            mm.setPriority(memory.key, Math.floor(priority * 100));
          }
        }
    
        const sortedMemories = prioritizedMemories
          .sort((a, b) => b.priority - a.priority)
          .slice(0, 20);
    
        const resultList = sortedMemories.map(pm =>
          `• [${(pm.priority * 100).toFixed(0)}%] ${pm.memory.key} (${pm.reason}): ${pm.memory.value.substring(0, 60)}${pm.memory.value.length > 60 ? '...' : ''}`
        ).join('\n');
    
        return {
          content: [{
            type: 'text',
            text: `✓ Prioritized ${sortedMemories.length} memories for "${currentTask}":\n${resultList || 'None'}`
          }]
        };
      } catch (error) {
        return {
          content: [{ type: 'text', text: `✗ Error: ${error instanceof Error ? error.message : 'Unknown error'}` }]
        };
      }
    }
  • The ToolDefinition object defining the input schema, description, and annotations for the prioritize_memory tool.
    export const prioritizeMemoryDefinition: ToolDefinition = {
      name: 'prioritize_memory',
      description: '중요한 거|우선순위|prioritize|important|what matters|priority - Prioritize memories by importance',
      inputSchema: {
        type: 'object',
        properties: {
          currentTask: { type: 'string', description: 'Current task description' },
          criticalDecisions: { type: 'array', items: { type: 'string' }, description: 'List of critical decisions made' },
          codeChanges: { type: 'array', items: { type: 'string' }, description: 'Important code changes' },
          blockers: { type: 'array', items: { type: 'string' }, description: 'Current blockers or issues' },
          nextSteps: { type: 'array', items: { type: 'string' }, description: 'Planned next steps' }
        },
        required: ['currentTask']
      },
      annotations: {
        title: 'Prioritize Memory',
        audience: ['user', 'assistant'],
        readOnlyHint: true,
        destructiveHint: false,
        idempotentHint: true,
        openWorldHint: false
      }
    };
  • src/index.ts:166-166 (registration)
    Registration of the prioritizeMemory handler in the toolHandlers registry for dynamic dispatch.
    'prioritize_memory': prioritizeMemory,
  • src/index.ts:99-99 (registration)
    Inclusion of the prioritizeMemoryDefinition in the tools array used for listing available tools.
    prioritizeMemoryDefinition,
  • src/index.ts:47-47 (registration)
    Import statement bringing in the tool definition and handler from the implementation file.
    import { prioritizeMemoryDefinition, prioritizeMemory } from './tools/memory/prioritizeMemory.js';
Behavior3/5

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

The annotations provide significant behavioral information: readOnlyHint=true, openWorldHint=false, idempotentHint=true, destructiveHint=false. The description doesn't contradict these annotations, but it also adds minimal behavioral context beyond them. It doesn't explain what 'prioritize' means operationally - whether this is a filtering operation, a sorting operation, or a metadata update. For a tool with good annotation coverage, the description adds some value by emphasizing the importance/priority aspect but lacks detail on the actual behavior.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness2/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is extremely brief but not effectively concise. It's essentially a keyword list separated by pipes and a dash, which creates confusion rather than clarity. While it's short, it's poorly structured - the pipe-separated synonyms don't form coherent sentences, and the dash-separated final phrase doesn't properly explain the tool. This isn't appropriate conciseness but rather under-specification with confusing formatting.

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 a 5-parameter tool with no output schema, the description is severely incomplete. While annotations cover safety aspects (read-only, non-destructive, idempotent), the description fails to explain what the tool actually produces or how it works. For a prioritization tool that presumably outputs some form of prioritized list or ranking, the absence of output information combined with the vague description leaves significant gaps in understanding the tool's functionality and results.

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?

Schema description coverage is 100%, with all 5 parameters well-documented in the input schema. The description provides no additional parameter information whatsoever - it doesn't explain how the parameters relate to prioritization, what format the prioritization output might take, or how different parameter combinations affect results. With complete schema coverage, the baseline is 3, and the description doesn't enhance understanding of parameter usage beyond what the schema already provides.

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 is a tautology that essentially restates the tool name 'prioritize_memory' with synonyms like 'important', 'priority', and 'what matters'. It doesn't specify what the tool actually does - whether it reorders existing memories, assigns priority scores, or creates prioritized memory entries. The description fails to distinguish this tool from sibling memory tools like 'list_memories', 'save_memory', or 'update_memory'.

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?

The description provides absolutely no guidance on when to use this tool versus alternatives. With multiple sibling tools related to memory management (create_memory_timeline, delete_memory, get_memory_graph, link_memories, list_memories, recall_memory, save_memory, search_memories_advanced, update_memory), there's no indication of when prioritization is appropriate versus listing, searching, creating, or updating memories. The description offers no context about prerequisites or appropriate situations for use.

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/su-record/hi-ai'

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