Skip to main content
Glama

context_list

Retrieve recent Claude Code contexts to review conversations, code snippets, suggestions, or errors across sessions.

Instructions

List recent Claude Code contexts

Input Schema

NameRequiredDescriptionDefault
limitNoMaximum number of results
typeNoFilter by type (conversation, code, suggestion, error)

Input Schema (JSON Schema)

{ "properties": { "limit": { "default": 20, "description": "Maximum number of results", "type": "integer" }, "type": { "description": "Filter by type (conversation, code, suggestion, error)", "enum": [ "conversation", "code", "suggestion", "error" ], "type": "string" } }, "type": "object" }

Implementation Reference

  • The handler logic for the 'context_list' tool within the call_tool method. It retrieves recent contexts using storage.list_contexts with optional limit and type filter, formats them, and returns as TextContent.
    if name == "context_list": limit = arguments.get("limit", 20) type_filter = arguments.get("type") contexts = self.storage.list_contexts(type_filter=type_filter, limit=limit) result = self._format_contexts_response(contexts) return [TextContent(type="text", text=result)]
  • Input schema definition for the 'context_list' tool, including properties for limit and type filter.
    Tool( name="context_list", description="List recent Claude Code contexts", inputSchema={ "type": "object", "properties": { "limit": { "type": "integer", "description": "Maximum number of results", "default": 20, }, "type": { "type": "string", "description": "Filter by type (conversation, code, suggestion, error)", "enum": ["conversation", "code", "suggestion", "error"], }, }, }, ),
  • The list_tools method registers the 'context_list' tool by including it in the returned list of Tool objects, which is hooked to the MCP server.
    async def list_tools(self) -> list[Tool]: """List available tools.""" return [ # Context tools Tool( name="context_search", description="Search Claude Code contexts by query string or tags", inputSchema={ "type": "object", "properties": { "query": {"type": "string", "description": "Search query"}, "tags": { "type": "array", "items": {"type": "string"}, "description": "Filter by tags", }, "type": { "type": "string", "description": "Filter by type (conversation, code, suggestion, error)", "enum": ["conversation", "code", "suggestion", "error"], }, "limit": { "type": "integer", "description": "Maximum number of results", "default": 10, }, }, }, ), Tool( name="context_get", description="Get full details of a specific context by ID", inputSchema={ "type": "object", "properties": { "context_id": {"type": "string", "description": "Context ID"}, }, "required": ["context_id"], }, ), Tool( name="context_list", description="List recent Claude Code contexts", inputSchema={ "type": "object", "properties": { "limit": { "type": "integer", "description": "Maximum number of results", "default": 20, }, "type": { "type": "string", "description": "Filter by type (conversation, code, suggestion, error)", "enum": ["conversation", "code", "suggestion", "error"], }, }, }, ), Tool( name="context_delete", description="Delete a specific context by ID", inputSchema={ "type": "object", "properties": { "context_id": {"type": "string", "description": "Context ID to delete"}, }, "required": ["context_id"], }, ), 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"], }, ), # Todo tools Tool( name="todo_search", description="Search todo snapshots by content or context description", inputSchema={ "type": "object", "properties": { "query": {"type": "string", "description": "Search query"}, "project_path": { "type": "string", "description": "Filter by project path", }, "limit": { "type": "integer", "description": "Maximum number of results", "default": 10, }, }, "required": ["query"], }, ), Tool( name="todo_get", description="Get full details of a specific todo snapshot by ID", inputSchema={ "type": "object", "properties": { "snapshot_id": {"type": "string", "description": "Todo snapshot ID"}, }, "required": ["snapshot_id"], }, ), Tool( name="todo_list", description="List recent todo snapshots", inputSchema={ "type": "object", "properties": { "limit": { "type": "integer", "description": "Maximum number of results", "default": 20, }, "project_path": { "type": "string", "description": "Filter by project path", }, }, }, ), Tool( name="todo_save", description="Save a new todo snapshot", inputSchema={ "type": "object", "properties": { "todos": { "type": "array", "items": { "type": "object", "properties": { "content": {"type": "string"}, "status": {"type": "string", "enum": ["pending", "in_progress", "completed"]}, "activeForm": {"type": "string"}, }, "required": ["content", "status", "activeForm"], }, "description": "List of todo items", }, "project_path": { "type": "string", "description": "Project path (defaults to current directory)", }, "context": { "type": "string", "description": "Description of what you're working on", }, "session_context_id": { "type": "string", "description": "Link to existing context ID", }, }, "required": ["todos"], }, ), Tool( name="todo_restore", description="Get todo snapshot for restoring (active snapshot or specific ID)", inputSchema={ "type": "object", "properties": { "snapshot_id": { "type": "string", "description": "Specific snapshot ID (optional, defaults to active snapshot)", }, "project_path": { "type": "string", "description": "Project path (used if snapshot_id not provided)", }, }, }, ), Tool( name="todo_delete", description="Delete a specific todo snapshot by ID", inputSchema={ "type": "object", "properties": { "snapshot_id": {"type": "string", "description": "Todo snapshot ID to delete"}, }, "required": ["snapshot_id"], }, ), # AI opinion tools Tool( name="ask_chatgpt", description="Ask ChatGPT a question about a context entry, or get a general second opinion", inputSchema={ "type": "object", "properties": { "context_id": {"type": "string", "description": "Context ID to ask about"}, "question": { "type": "string", "description": ( "Optional specific question to ask about the context. If not provided, gets a general second opinion." ), }, }, "required": ["context_id"], }, ), Tool( name="ask_claude", description="Ask Claude a question about a context entry, or get a general second opinion", inputSchema={ "type": "object", "properties": { "context_id": {"type": "string", "description": "Context ID to ask about"}, "question": { "type": "string", "description": ( "Optional specific question to ask about the context. If not provided, gets a general second opinion." ), }, }, "required": ["context_id"], }, ), Tool( name="ask_gemini", description="Ask Google Gemini a question about a context entry, or get a general second opinion", inputSchema={ "type": "object", "properties": { "context_id": {"type": "string", "description": "Context ID to ask about"}, "question": { "type": "string", "description": ( "Optional specific question to ask about the context. If not provided, gets a general second opinion." ), }, }, "required": ["context_id"], }, ), Tool( name="ask_deepseek", description="Ask DeepSeek a question about a context entry, or get a general second opinion", inputSchema={ "type": "object", "properties": { "context_id": {"type": "string", "description": "Context ID to ask about"}, "question": { "type": "string", "description": ( "Optional specific question to ask about the context. If not provided, gets a general second opinion." ), }, }, "required": ["context_id"], }, ), ]
  • Helper method used by the context_list handler to format the list of contexts into a readable string response.
    def _format_contexts_response(self, contexts: list[ContextEntry]) -> str: """Format a list of contexts for response.""" if not contexts: return "No contexts found." lines = [f"Found {len(contexts)} contexts:\n"] for ctx in contexts: chatgpt_icon = "āœ“" if ctx.chatgpt_response else "ā—‹" claude_icon = "āœ“" if ctx.claude_response else "ā—‹" gemini_icon = "āœ“" if ctx.gemini_response else "ā—‹" deepseek_icon = "āœ“" if ctx.deepseek_response else "ā—‹" tags_str = f" [{', '.join(ctx.tags)}]" if ctx.tags else "" ai_icons = f"GPT:{chatgpt_icon} Claude:{claude_icon} Gemini:{gemini_icon} DeepSeek:{deepseek_icon}" lines.append(f"{ai_icons} [{ctx.type}] {ctx.title}{tags_str}\n ID: {ctx.id}\n Timestamp: {ctx.timestamp.isoformat()}\n") return "\n".join(lines)

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