Skip to main content
Glama

save_project_context

Store project-specific information with relationships to maintain context across sessions in Claude Server MCP.

Instructions

Save project-specific context with relationships

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesUnique identifier for the context
projectIdYesProject identifier
contentYesContext content to save
parentContextIdNoOptional ID of parent context
referencesNoOptional related context IDs
tagsNoOptional tags for categorizing
metadataNoOptional additional metadata

Implementation Reference

  • Handler for the 'save_project_context' tool. Extracts input arguments, constructs a ProjectContext object, saves it using the saveContext method, and returns a confirmation message.
    case 'save_project_context': { const { id, projectId, content, parentContextId, references, tags, metadata, } = request.params.arguments as { id: string; projectId: string; content: string; parentContextId?: string; references?: string[]; tags?: string[]; metadata?: Record<string, unknown>; }; const context: ProjectContext = { id, projectId, content, timestamp: new Date().toISOString(), parentContextId, references, tags, metadata, }; await this.saveContext(context); return { content: [ { type: 'text', text: `Project context saved with ID: ${id}`, }, ], }; }
  • src/index.ts:175-214 (registration)
    Tool registration in the ListTools response, including name, description, and full input schema for 'save_project_context'.
    { name: 'save_project_context', description: 'Save project-specific context with relationships', inputSchema: { type: 'object', properties: { id: { type: 'string', description: 'Unique identifier for the context', }, projectId: { type: 'string', description: 'Project identifier', }, content: { type: 'string', description: 'Context content to save', }, parentContextId: { type: 'string', description: 'Optional ID of parent context', }, references: { type: 'array', items: { type: 'string' }, description: 'Optional related context IDs', }, tags: { type: 'array', items: { type: 'string' }, description: 'Optional tags for categorizing', }, metadata: { type: 'object', description: 'Optional additional metadata', }, }, required: ['id', 'projectId', 'content'], }, },
  • TypeScript interface definition for ProjectContext, used in the tool's handler for type safety.
    interface ProjectContext extends BaseContext { projectId: string; parentContextId?: string; references?: string[]; }
  • Core helper method that handles persisting the context to a JSON file and updating the central index. Invoked by the tool handler.
    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