delete_space
Remove a specified space and all its contents permanently using the space's unique identifier (DUID). Ideal for workspace cleanup and resource management in the Dart MCP Server environment.
Instructions
Delete a space and all its contents
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| space_duid | Yes | DUID of the space to delete |
Implementation Reference
- src/index.ts:1106-1159 (handler)Handler for the 'delete_space' tool. Generates embedded Python code to create a DELETE Operation on the SPACE model using the Dart client library, targeting the specified space_duid, and executes it via runDartCommand method.case 'delete_space': { console.error('[Debug] Handling delete_space request'); const pythonCode = ` # Delete space print("[Debug] Starting space deletion", file=sys.stderr) try: # Parse space_duid from args space_duid = "${args.space_duid}" print(f"[Debug] Deleting space with DUID: {space_duid}", file=sys.stderr) # Create the delete operation delete_op = Operation( model=OperationModelKind.SPACE, kind=OperationKind.DELETE, data={"duid": space_duid} # For delete operations, we just need the DUID ) print("[Debug] Created delete operation", file=sys.stderr) # Execute the transaction print("[Debug] Executing transaction", file=sys.stderr) response = client.transact([delete_op], TransactionKind.SPACE_DELETE) print("[Debug] Transaction completed", file=sys.stderr) if response.results and response.results[0].success: print(f"Space {space_duid} deleted successfully") print(f"[Debug] Space deletion successful", file=sys.stderr) else: print("[Debug] Space deletion failed", file=sys.stderr) if response.results: print(f"[Debug] Result: {response.results[0]}", file=sys.stderr) sys.exit(1) except Exception as e: print(f"[Debug] Error deleting space: {str(e)}", file=sys.stderr) print("[Debug] Error type:", type(e), file=sys.stderr) traceback.print_exc(file=sys.stderr) sys.exit(1)`; // Add proper indentation to the Python code const command = pythonCode.split('\n').map(line => { if (line.trim().length === 0) return line; return ' ' + line; }).join('\n'); console.error('[Debug] Running Python command for space deletion'); const output = await this.runDartCommand(command); console.error('[Debug] Space deletion output:', output); const response = { content: [{ type: 'text', text: output, }], }; return response; }
- src/index.ts:496-509 (registration)Registration of the 'delete_space' tool in the listTools response, including its name, description, and input schema.{ name: 'delete_space', description: 'Delete a space and all its contents', inputSchema: { type: 'object', properties: { space_duid: { type: 'string', description: 'DUID of the space to delete' } }, required: ['space_duid'] } }
- src/index.ts:499-508 (schema)Input schema definition for the 'delete_space' tool, specifying the required 'space_duid' parameter.inputSchema: { type: 'object', properties: { space_duid: { type: 'string', description: 'DUID of the space to delete' } }, required: ['space_duid'] }