Skip to main content
Glama

save_conversation_context

Store conversation context with session tracking and continuation support to maintain persistent dialogue history across interactions.

Instructions

Save conversation context with continuation support

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesUnique identifier for the context
sessionIdYesConversation session identifier
contentYesContext content to save
continuationOfNoOptional ID of previous context
tagsNoOptional tags for categorizing
metadataNoOptional additional metadata

Implementation Reference

  • src/index.ts:215-249 (registration)
    Registration of the 'save_conversation_context' tool including name, description, and input schema in the ListTools response.
    { name: 'save_conversation_context', description: 'Save conversation context with continuation support', inputSchema: { type: 'object', properties: { id: { type: 'string', description: 'Unique identifier for the context', }, sessionId: { type: 'string', description: 'Conversation session identifier', }, content: { type: 'string', description: 'Context content to save', }, continuationOf: { type: 'string', description: 'Optional ID of previous context', }, tags: { type: 'array', items: { type: 'string' }, description: 'Optional tags for categorizing', }, metadata: { type: 'object', description: 'Optional additional metadata', }, }, required: ['id', 'sessionId', 'content'], }, },
  • Handler logic for executing the save_conversation_context tool: destructures input arguments, builds ConversationContext object, calls saveContext helper, returns success text response.
    case 'save_conversation_context': { const { id, sessionId, content, continuationOf, tags, metadata, } = request.params.arguments as { id: string; sessionId: string; content: string; continuationOf?: string; tags?: string[]; metadata?: Record<string, unknown>; }; const context: ConversationContext = { id, sessionId, content, timestamp: new Date().toISOString(), continuationOf, tags, metadata, }; await this.saveContext(context); return { content: [ { type: 'text', text: `Conversation context saved with ID: ${id}`, }, ], }; }
  • JSON schema defining the input parameters for the save_conversation_context tool.
    inputSchema: { type: 'object', properties: { id: { type: 'string', description: 'Unique identifier for the context', }, sessionId: { type: 'string', description: 'Conversation session identifier', }, content: { type: 'string', description: 'Context content to save', }, continuationOf: { type: 'string', description: 'Optional ID of previous context', }, tags: { type: 'array', items: { type: 'string' }, description: 'Optional tags for categorizing', }, metadata: { type: 'object', description: 'Optional additional metadata', }, }, required: ['id', 'sessionId', 'content'], },
  • Core helper method that persists the context to a JSON file in the appropriate directory and updates the global index.
    private async saveContext(context: Context) { await this.ensureDirectories(); const contextPath = await this.getContextPath( context.id, 'projectId' in context ? context.projectId : undefined ); await fs.writeFile(contextPath, JSON.stringify(context, null, 2), 'utf-8'); await this.updateIndex(context); }

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/davidteren/claude-server'

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