Skip to main content
Glama

mcp-structured-memory

getSection.ts1.32 kB
import { StorageManager } from '../storage/StorageManager.js'; import { GetSectionParams } from '../types/memory.js'; export async function getSectionTool( storageManager: StorageManager, args: any ): Promise<any> { const params = args as GetSectionParams; if (!params.memory_id || !params.section) { throw new Error('Both memory_id and section are required'); } // Read the memory document const memory = await storageManager.readMemory(params.memory_id); if (!memory) { throw new Error(`Memory document '${params.memory_id}' not found`); } // Find the section const section = storageManager.findSection(memory.content, params.section); if (!section) { // List available sections to help the user const allSections = storageManager.parseSections(memory.content); const sectionNames = allSections.map(s => s.name).join(', '); throw new Error( `Section '${params.section}' not found in memory document '${params.memory_id}'. ` + `Available sections: ${sectionNames}` ); } const sectionContent = section.content || '(This section is empty)'; return { content: [{ type: 'text', text: `## ${section.name} ${sectionContent} --- *From memory document: ${params.memory_id}* *Last updated: ${memory.metadata.updated}*` }] }; }

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/nmeierpolys/mcp-structured-memory'

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