Skip to main content
Glama

delete_project

Remove a project from Basic Memory's configuration and database records while preserving the actual files on disk. This action cannot be undone.

Instructions

Delete a Basic Memory project.

Removes a project from the configuration and database. This does NOT delete the actual files on disk - only removes the project from Basic Memory's configuration and database records.

Args: project_name: Name of the project to delete

Returns: Confirmation message about project deletion

Example: delete_project("old-project")

Warning: This action cannot be undone. The project will need to be re-added to access its content through Basic Memory again.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
project_nameYes

Implementation Reference

  • The MCP tool handler implementation for 'delete_project'. This function handles project validation, API deletion call via internal HTTP client, and formats the response message. The @mcp.tool() decorator registers it with the FastMCP server using the function name as the tool name.
    @mcp.tool() async def delete_project(project_name: str, context: Context | None = None) -> str: """Delete a Basic Memory project. Removes a project from the configuration and database. This does NOT delete the actual files on disk - only removes the project from Basic Memory's configuration and database records. Args: project_name: Name of the project to delete Returns: Confirmation message about project deletion Example: delete_project("old-project") Warning: This action cannot be undone. The project will need to be re-added to access its content through Basic Memory again. """ async with get_client() as client: # Check if server is constrained to a specific project constrained_project = os.environ.get("BASIC_MEMORY_MCP_PROJECT") if constrained_project: return f"# Error\n\nProject deletion disabled - MCP server is constrained to project '{constrained_project}'.\nUse the CLI to delete projects: `basic-memory project remove \"{project_name}\"`" if context: # pragma: no cover await context.info(f"Deleting project: {project_name}") # Get project info before deletion to validate it exists response = await call_get(client, "/projects/projects") project_list = ProjectList.model_validate(response.json()) # Find the project by name (case-insensitive) or permalink - same logic as switch_project project_permalink = generate_permalink(project_name) target_project = None for p in project_list.projects: # Match by permalink (handles case-insensitive input) if p.permalink == project_permalink: target_project = p break # Also match by name comparison (case-insensitive) if p.name.lower() == project_name.lower(): target_project = p break if not target_project: available_projects = [p.name for p in project_list.projects] raise ValueError( f"Project '{project_name}' not found. Available projects: {', '.join(available_projects)}" ) # Call API to delete project using URL encoding for special characters from urllib.parse import quote encoded_name = quote(target_project.name, safe="") response = await call_delete(client, f"/projects/{encoded_name}") status_response = ProjectStatusResponse.model_validate(response.json()) result = f"✓ {status_response.message}\n\n" if status_response.old_project: result += "Removed project details:\n" result += f"• Name: {status_response.old_project.name}\n" if hasattr(status_response.old_project, "path"): result += f"• Path: {status_response.old_project.path}\n" result += "Files remain on disk but project is no longer tracked by Basic Memory.\n" result += "Re-add the project to access its content again.\n" return result

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