Skip to main content
Glama

localnest_task_context

Bundle runtime status, memory state, and relevant recall for non-trivial tasks in one call to provide AI agents with comprehensive project context.

Instructions

Bundle runtime status, memory state, and relevant recall for a non-trivial task in one call.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryNo
taskNo
root_pathNo
project_pathNo
branch_nameNo
topicNo
featureNo
kindNoknowledge
limitNo
response_formatNojson

Implementation Reference

  • The 'getTaskContext' method in 'MemoryWorkflowService' is the handler that executes the 'localnest_task_context' tool logic.
    async getTaskContext(input = {}) {
      const query = deriveQuery(input);
      const memoryStatus = await this.memory.getStatus();
      const runtime = this.getRuntimeSummary ? await this.getRuntimeSummary() : null;
      const memorySummary = compactMemoryStatus(memoryStatus);
      const canRecall = memorySummary.enabled && memorySummary.backend_available;
    
      let recall = {
        attempted: false,
        skipped_reason: ''
      };
    
      if (!query) {
        recall.skipped_reason = 'empty_query';
      } else if (!memorySummary.enabled) {
        recall.skipped_reason = 'memory_disabled';
      } else if (!memorySummary.backend_available) {
        recall.skipped_reason = 'backend_unavailable';
      } else {
        const recalled = await this.memory.recall({
          query,
          rootPath: input.root_path || input.rootPath,
          projectPath: input.project_path || input.projectPath,
          branchName: input.branch_name || input.branchName,
          topic: input.topic,
          feature: input.feature,
          kind: input.kind,
          limit: input.limit
        });
        recall = {
          attempted: true,
          skipped_reason: '',
          ...recalled
        };
      }
    
      const guidance = canRecall
        ? [
          'Use recalled items as hints, then verify them with search/read tools before concluding.',
          recall.attempted && recall.count > 0
            ? 'Relevant project memory was found; check the linked files and current code before reusing the prior approach.'
            : 'No matching memory was found; continue with retrieval tools and capture the outcome if the work produces durable knowledge.'
        ]
        : [
          'Memory is disabled or unavailable on this runtime; rely on retrieval tools only.'
        ];
    
      return {
        query,
        scope: {
          root_path: input.root_path || input.rootPath || '',
          project_path: input.project_path || input.projectPath || '',
          branch_name: input.branch_name || input.branchName || '',
          topic: input.topic || '',
          feature: input.feature || ''
        },
        runtime,
        memory: memorySummary,
        recall,
        guidance
      };
    }
  • The 'localnest_task_context' tool is registered in 'src/mcp/tools/memory-workflow.js' using 'registerJsonTool'.
    registerJsonTool(
      ['localnest_task_context'],
      {
        title: 'Task Context',
        description: 'Bundle runtime status, memory state, and relevant recall for a non-trivial task in one call.',
        inputSchema: {
          query: z.string().optional(),
          task: z.string().optional(),
          root_path: z.string().optional(),
          project_path: z.string().optional(),
          branch_name: z.string().optional(),
          topic: z.string().optional(),
          feature: z.string().optional(),
          kind: MEMORY_KIND_SCHEMA.optional(),
          limit: z.number().int().min(1).max(20).default(8)
        },
        annotations: {
          readOnlyHint: true,
          destructiveHint: false,
          idempotentHint: false,
          openWorldHint: false
        }
      },
      async (args) => normalizeTaskContextResult(await memoryWorkflow.getTaskContext(args), args)
    );

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/wmt-mobile/localnest'

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