Skip to main content
Glama

delete_space

Remove a workspace and all its contents using the space's unique identifier (DUID).

Instructions

Delete a space and all its contents

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
space_duidYesDUID of the space to delete

Implementation Reference

  • src/index.ts:497-510 (registration)
    Registration of the 'delete_space' tool in the listTools handler, including its 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']
            }
        }
    ];
  • The handler for 'delete_space' tool. It generates Python code that uses the Dart client to create a DELETE operation on the SPACE model with the given space_duid and executes it via transact with SPACE_DELETE transaction kind.
                    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;
                    }

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/jmanhype/dart-mcp-server'

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