Skip to main content
Glama
taylorleese

mcp-toolz

context_save

Save context entries like conversations, code snippets, suggestions, or errors for project continuity across sessions. Organize with titles, content, and tags for easy retrieval.

Instructions

Save a new context entry for the current project

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
typeYesContext type
titleYesContext title
contentYesContext content
tagsNoTags for categorization
session_context_idNoLink to existing context ID

Implementation Reference

  • Executes the context_save tool: parses input arguments, constructs ContextContent and ContextEntry based on type, adds session info and optional link, then saves via storage.
    if name == "context_save":
        from models import ContextContent
    
        context_type = arguments["type"]
        title = arguments["title"]
        content_text = arguments["content"]
        tags = arguments.get("tags", [])
        session_context_id = arguments.get("session_context_id")
    
        # Parse content based on type
        if context_type == "conversation":
            content = ContextContent(messages=[content_text])
        elif context_type == "code":
            content = ContextContent(code={"snippet": content_text})
        elif context_type == "suggestion":
            content = ContextContent(suggestions=content_text)
        elif context_type == "error":
            content = ContextContent(errors=content_text)
        else:
            content = ContextContent(messages=[content_text])
    
        # Create context entry with session info
        context = ContextEntry(
            type=context_type,
            title=title,
            content=content,
            tags=tags,
            project_path=os.getcwd(),
            session_id=self.session_id,
            session_timestamp=self.session_timestamp,
        )
    
        # Link to session context if provided
        if session_context_id:
            context.metadata["session_context_id"] = session_context_id
    
        self.storage.save_context(context)
        return [TextContent(type="text", text=f"✓ Context saved (ID: {context.id})")]
  • Registers the context_save tool in list_tools() with name, description, and input schema defining required fields and options.
    Tool(
        name="context_save",
        description="Save a new context entry for the current project",
        inputSchema={
            "type": "object",
            "properties": {
                "type": {
                    "type": "string",
                    "description": "Context type",
                    "enum": ["conversation", "code", "suggestion", "error"],
                },
                "title": {"type": "string", "description": "Context title"},
                "content": {"type": "string", "description": "Context content"},
                "tags": {
                    "type": "array",
                    "items": {"type": "string"},
                    "description": "Tags for categorization",
                },
                "session_context_id": {
                    "type": "string",
                    "description": "Link to existing context ID",
                },
            },
            "required": ["type", "title", "content"],
        },
    ),
  • JSON schema for input validation of context_save tool parameters.
    inputSchema={
        "type": "object",
        "properties": {
            "type": {
                "type": "string",
                "description": "Context type",
                "enum": ["conversation", "code", "suggestion", "error"],
            },
            "title": {"type": "string", "description": "Context title"},
            "content": {"type": "string", "description": "Context content"},
            "tags": {
                "type": "array",
                "items": {"type": "string"},
                "description": "Tags for categorization",
            },
            "session_context_id": {
                "type": "string",
                "description": "Link to existing context ID",
            },
        },
        "required": ["type", "title", "content"],
    },

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/taylorleese/mcp-toolz'

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