Skip to main content
Glama

list_memory_projects

Discover available knowledge projects in your Basic Memory system to identify which project to use for MCP operations. Shows project status and provides session management guidance.

Instructions

List all available projects with their status.

Shows all Basic Memory projects that are available for MCP operations. Use this tool to discover projects when you need to know which project to use.

Use this tool:

  • At conversation start when project is unknown

  • When user asks about available projects

  • Before any operation requiring a project

After calling:

  • Ask user which project to use

  • Remember their choice for the session

Returns: Formatted list of projects with session management guidance

Example: list_memory_projects()

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The main execution logic for the list_memory_projects MCP tool. Fetches project list from internal API, handles constrained mode, and returns formatted string response.
    @mcp.tool("list_memory_projects") async def list_memory_projects(context: Context | None = None) -> str: """List all available projects with their status. Shows all Basic Memory projects that are available for MCP operations. Use this tool to discover projects when you need to know which project to use. Use this tool: - At conversation start when project is unknown - When user asks about available projects - Before any operation requiring a project After calling: - Ask user which project to use - Remember their choice for the session Returns: Formatted list of projects with session management guidance Example: list_memory_projects() """ track_mcp_tool("list_memory_projects") async with get_client() as client: if context: # pragma: no cover await context.info("Listing all available projects") # Check if server is constrained to a specific project constrained_project = os.environ.get("BASIC_MEMORY_MCP_PROJECT") # Get projects from API response = await call_get(client, "/projects/projects") project_list = ProjectList.model_validate(response.json()) if constrained_project: result = f"Project: {constrained_project}\n\n" result += "Note: This MCP server is constrained to a single project.\n" result += "All operations will automatically use this project." else: # Show all projects with session guidance result = "Available projects:\n" for project in project_list.projects: result += f"• {project.name}\n" result += "\n" + "─" * 40 + "\n" result += "Next: Ask which project to use for this session.\n" result += "Example: 'Which project should I use for this task?'\n\n" result += "Session reminder: Track the selected project for all subsequent operations in this conversation.\n" result += "The user can say 'switch to [project]' to change projects." return result
  • Pydantic model ProjectList used by the tool to validate and parse the JSON response from the /projects/projects API endpoint.
    class ProjectList(BaseModel): """Response model for listing projects.""" projects: List[ProjectItem] default_project: str
  • Import of the list_memory_projects handler function into the tools module, which triggers registration via the @mcp.tool decorator.
    from basic_memory.mcp.tools.project_management import ( list_memory_projects, create_memory_project, delete_project, )

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/basicmachines-co/basic-memory'

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