@gcnv/gcnv-mcp-server 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/GEMINI.md +200 -0
  2. package/LICENSE +201 -0
  3. package/README.md +374 -0
  4. package/build/index.js +185 -0
  5. package/build/logger.js +19 -0
  6. package/build/registry/register-tools.js +101 -0
  7. package/build/registry/tool-registry.js +27 -0
  8. package/build/tools/active-directory-tools.js +124 -0
  9. package/build/tools/backup-policy-tools.js +140 -0
  10. package/build/tools/backup-tools.js +178 -0
  11. package/build/tools/backup-vault-tools.js +147 -0
  12. package/build/tools/handlers/active-directory-handler.js +321 -0
  13. package/build/tools/handlers/backup-handler.js +451 -0
  14. package/build/tools/handlers/backup-policy-handler.js +275 -0
  15. package/build/tools/handlers/backup-vault-handler.js +370 -0
  16. package/build/tools/handlers/kms-config-handler.js +327 -0
  17. package/build/tools/handlers/operation-handler.js +254 -0
  18. package/build/tools/handlers/quota-rule-handler.js +411 -0
  19. package/build/tools/handlers/replication-handler.js +504 -0
  20. package/build/tools/handlers/snapshot-handler.js +320 -0
  21. package/build/tools/handlers/storage-pool-handler.js +346 -0
  22. package/build/tools/handlers/volume-handler.js +353 -0
  23. package/build/tools/kms-config-tools.js +162 -0
  24. package/build/tools/operation-tools.js +64 -0
  25. package/build/tools/quota-rule-tools.js +166 -0
  26. package/build/tools/replication-tools.js +227 -0
  27. package/build/tools/snapshot-tools.js +124 -0
  28. package/build/tools/storage-pool-tools.js +215 -0
  29. package/build/tools/volume-tools.js +216 -0
  30. package/build/types/tool.js +1 -0
  31. package/build/utils/netapp-client-factory.js +53 -0
  32. package/gemini-extension.json +12 -0
  33. package/package.json +66 -0
@@ -0,0 +1,101 @@
1
+ import { createStoragePoolTool, deleteStoragePoolTool, getStoragePoolTool, listStoragePoolsTool, updateStoragePoolTool, validateDirectoryServiceTool, } from '../tools/storage-pool-tools.js';
2
+ import { createStoragePoolHandler, deleteStoragePoolHandler, getStoragePoolHandler, listStoragePoolsHandler, updateStoragePoolHandler, validateDirectoryServiceHandler, } from '../tools/handlers/storage-pool-handler.js';
3
+ import { createVolumeTool, deleteVolumeTool, getVolumeTool, listVolumesTool, updateVolumeTool, } from '../tools/volume-tools.js';
4
+ import { createVolumeHandler, deleteVolumeHandler, getVolumeHandler, listVolumesHandler, updateVolumeHandler, } from '../tools/handlers/volume-handler.js';
5
+ import { createSnapshotTool, deleteSnapshotTool, getSnapshotTool, listSnapshotsTool, revertVolumeToSnapshotTool, updateSnapshotTool, } from '../tools/snapshot-tools.js';
6
+ import { createSnapshotHandler, deleteSnapshotHandler, getSnapshotHandler, listSnapshotsHandler, revertVolumeToSnapshotHandler, updateSnapshotHandler, } from '../tools/handlers/snapshot-handler.js';
7
+ import { createBackupVaultTool, deleteBackupVaultTool, getBackupVaultTool, listBackupVaultsTool, updateBackupVaultTool, } from '../tools/backup-vault-tools.js';
8
+ import { createBackupVaultHandler, deleteBackupVaultHandler, getBackupVaultHandler, listBackupVaultsHandler, updateBackupVaultHandler, } from '../tools/handlers/backup-vault-handler.js';
9
+ import { createBackupTool, deleteBackupTool, getBackupTool, listBackupsTool, restoreBackupTool, updateBackupTool, } from '../tools/backup-tools.js';
10
+ import { createBackupHandler, deleteBackupHandler, getBackupHandler, listBackupsHandler, restoreBackupHandler, updateBackupHandler, } from '../tools/handlers/backup-handler.js';
11
+ import { getOperationTool, cancelOperationTool, listOperationsTool, } from '../tools/operation-tools.js';
12
+ import { getOperationHandler, cancelOperationHandler, listOperationsHandler, } from '../tools/handlers/operation-handler.js';
13
+ import { createBackupPolicyTool, deleteBackupPolicyTool, getBackupPolicyTool, listBackupPoliciesTool, updateBackupPolicyTool, } from '../tools/backup-policy-tools.js';
14
+ import { backupPolicyHandlers } from '../tools/handlers/backup-policy-handler.js';
15
+ import { createReplicationTool, deleteReplicationTool, getReplicationTool, listReplicationsTool, updateReplicationTool, resumeReplicationTool, stopReplicationTool, reverseReplicationDirectionTool, establishPeeringTool, syncReplicationTool, } from '../tools/replication-tools.js';
16
+ import { createReplicationHandler, deleteReplicationHandler, getReplicationHandler, listReplicationsHandler, updateReplicationHandler, resumeReplicationHandler, stopReplicationHandler, reverseReplicationDirectionHandler, establishPeeringHandler, syncReplicationHandler, } from '../tools/handlers/replication-handler.js';
17
+ import { createActiveDirectoryTool, deleteActiveDirectoryTool, getActiveDirectoryTool, listActiveDirectoriesTool, updateActiveDirectoryTool, } from '../tools/active-directory-tools.js';
18
+ import { createActiveDirectoryHandler, deleteActiveDirectoryHandler, getActiveDirectoryHandler, listActiveDirectoriesHandler, updateActiveDirectoryHandler, } from '../tools/handlers/active-directory-handler.js';
19
+ import { createKmsConfigTool, deleteKmsConfigTool, getKmsConfigTool, listKmsConfigsTool, updateKmsConfigTool, verifyKmsConfigTool, encryptVolumesTool, } from '../tools/kms-config-tools.js';
20
+ import { createKmsConfigHandler, deleteKmsConfigHandler, getKmsConfigHandler, listKmsConfigsHandler, updateKmsConfigHandler, verifyKmsConfigHandler, encryptVolumesHandler, } from '../tools/handlers/kms-config-handler.js';
21
+ import { createQuotaRuleTool, deleteQuotaRuleTool, getQuotaRuleTool, listQuotaRulesTool, updateQuotaRuleTool, } from '../tools/quota-rule-tools.js';
22
+ import { createQuotaRuleHandler, deleteQuotaRuleHandler, getQuotaRuleHandler, listQuotaRulesHandler, updateQuotaRuleHandler, } from '../tools/handlers/quota-rule-handler.js';
23
+ /**
24
+ * Register all tools and their handlers to the tool registry
25
+ */
26
+ export function registerAllTools(mcpServer) {
27
+ // Register storage pool tools
28
+ mcpServer.registerTool(createStoragePoolTool.name, createStoragePoolTool, createStoragePoolHandler);
29
+ mcpServer.registerTool(deleteStoragePoolTool.name, deleteStoragePoolTool, deleteStoragePoolHandler);
30
+ mcpServer.registerTool(getStoragePoolTool.name, getStoragePoolTool, getStoragePoolHandler);
31
+ mcpServer.registerTool(listStoragePoolsTool.name, listStoragePoolsTool, listStoragePoolsHandler);
32
+ mcpServer.registerTool(updateStoragePoolTool.name, updateStoragePoolTool, updateStoragePoolHandler);
33
+ mcpServer.registerTool(validateDirectoryServiceTool.name, validateDirectoryServiceTool, validateDirectoryServiceHandler);
34
+ // Register volume tools
35
+ mcpServer.registerTool(createVolumeTool.name, createVolumeTool, createVolumeHandler);
36
+ mcpServer.registerTool(deleteVolumeTool.name, deleteVolumeTool, deleteVolumeHandler);
37
+ mcpServer.registerTool(getVolumeTool.name, getVolumeTool, getVolumeHandler);
38
+ mcpServer.registerTool(listVolumesTool.name, listVolumesTool, listVolumesHandler);
39
+ mcpServer.registerTool(updateVolumeTool.name, updateVolumeTool, updateVolumeHandler);
40
+ // Register snapshot tools
41
+ mcpServer.registerTool(createSnapshotTool.name, createSnapshotTool, createSnapshotHandler);
42
+ mcpServer.registerTool(deleteSnapshotTool.name, deleteSnapshotTool, deleteSnapshotHandler);
43
+ mcpServer.registerTool(getSnapshotTool.name, getSnapshotTool, getSnapshotHandler);
44
+ mcpServer.registerTool(listSnapshotsTool.name, listSnapshotsTool, listSnapshotsHandler);
45
+ mcpServer.registerTool(revertVolumeToSnapshotTool.name, revertVolumeToSnapshotTool, revertVolumeToSnapshotHandler);
46
+ mcpServer.registerTool(updateSnapshotTool.name, updateSnapshotTool, updateSnapshotHandler);
47
+ // Register backup vault tools
48
+ mcpServer.registerTool(createBackupVaultTool.name, createBackupVaultTool, createBackupVaultHandler);
49
+ mcpServer.registerTool(deleteBackupVaultTool.name, deleteBackupVaultTool, deleteBackupVaultHandler);
50
+ mcpServer.registerTool(getBackupVaultTool.name, getBackupVaultTool, getBackupVaultHandler);
51
+ mcpServer.registerTool(listBackupVaultsTool.name, listBackupVaultsTool, listBackupVaultsHandler);
52
+ mcpServer.registerTool(updateBackupVaultTool.name, updateBackupVaultTool, updateBackupVaultHandler);
53
+ // Register backup tools
54
+ mcpServer.registerTool(createBackupTool.name, createBackupTool, createBackupHandler);
55
+ mcpServer.registerTool(deleteBackupTool.name, deleteBackupTool, deleteBackupHandler);
56
+ mcpServer.registerTool(getBackupTool.name, getBackupTool, getBackupHandler);
57
+ mcpServer.registerTool(listBackupsTool.name, listBackupsTool, listBackupsHandler);
58
+ mcpServer.registerTool(restoreBackupTool.name, restoreBackupTool, restoreBackupHandler);
59
+ mcpServer.registerTool(updateBackupTool.name, updateBackupTool, updateBackupHandler);
60
+ // Register operation tools
61
+ mcpServer.registerTool(getOperationTool.name, getOperationTool, getOperationHandler);
62
+ mcpServer.registerTool(cancelOperationTool.name, cancelOperationTool, cancelOperationHandler);
63
+ mcpServer.registerTool(listOperationsTool.name, listOperationsTool, listOperationsHandler);
64
+ // Register backup policy tools
65
+ mcpServer.registerTool(createBackupPolicyTool.name, createBackupPolicyTool, backupPolicyHandlers[createBackupPolicyTool.name]);
66
+ mcpServer.registerTool(deleteBackupPolicyTool.name, deleteBackupPolicyTool, backupPolicyHandlers[deleteBackupPolicyTool.name]);
67
+ mcpServer.registerTool(getBackupPolicyTool.name, getBackupPolicyTool, backupPolicyHandlers[getBackupPolicyTool.name]);
68
+ mcpServer.registerTool(listBackupPoliciesTool.name, listBackupPoliciesTool, backupPolicyHandlers[listBackupPoliciesTool.name]);
69
+ mcpServer.registerTool(updateBackupPolicyTool.name, updateBackupPolicyTool, backupPolicyHandlers[updateBackupPolicyTool.name]);
70
+ // Register replication tools
71
+ mcpServer.registerTool(createReplicationTool.name, createReplicationTool, createReplicationHandler);
72
+ mcpServer.registerTool(deleteReplicationTool.name, deleteReplicationTool, deleteReplicationHandler);
73
+ mcpServer.registerTool(getReplicationTool.name, getReplicationTool, getReplicationHandler);
74
+ mcpServer.registerTool(listReplicationsTool.name, listReplicationsTool, listReplicationsHandler);
75
+ mcpServer.registerTool(updateReplicationTool.name, updateReplicationTool, updateReplicationHandler);
76
+ mcpServer.registerTool(resumeReplicationTool.name, resumeReplicationTool, resumeReplicationHandler);
77
+ mcpServer.registerTool(stopReplicationTool.name, stopReplicationTool, stopReplicationHandler);
78
+ mcpServer.registerTool(reverseReplicationDirectionTool.name, reverseReplicationDirectionTool, reverseReplicationDirectionHandler);
79
+ mcpServer.registerTool(establishPeeringTool.name, establishPeeringTool, establishPeeringHandler);
80
+ mcpServer.registerTool(syncReplicationTool.name, syncReplicationTool, syncReplicationHandler);
81
+ // Register active directory tools
82
+ mcpServer.registerTool(createActiveDirectoryTool.name, createActiveDirectoryTool, createActiveDirectoryHandler);
83
+ mcpServer.registerTool(deleteActiveDirectoryTool.name, deleteActiveDirectoryTool, deleteActiveDirectoryHandler);
84
+ mcpServer.registerTool(getActiveDirectoryTool.name, getActiveDirectoryTool, getActiveDirectoryHandler);
85
+ mcpServer.registerTool(listActiveDirectoriesTool.name, listActiveDirectoriesTool, listActiveDirectoriesHandler);
86
+ mcpServer.registerTool(updateActiveDirectoryTool.name, updateActiveDirectoryTool, updateActiveDirectoryHandler);
87
+ // Register KMS config tools
88
+ mcpServer.registerTool(createKmsConfigTool.name, createKmsConfigTool, createKmsConfigHandler);
89
+ mcpServer.registerTool(deleteKmsConfigTool.name, deleteKmsConfigTool, deleteKmsConfigHandler);
90
+ mcpServer.registerTool(getKmsConfigTool.name, getKmsConfigTool, getKmsConfigHandler);
91
+ mcpServer.registerTool(listKmsConfigsTool.name, listKmsConfigsTool, listKmsConfigsHandler);
92
+ mcpServer.registerTool(updateKmsConfigTool.name, updateKmsConfigTool, updateKmsConfigHandler);
93
+ mcpServer.registerTool(verifyKmsConfigTool.name, verifyKmsConfigTool, verifyKmsConfigHandler);
94
+ mcpServer.registerTool(encryptVolumesTool.name, encryptVolumesTool, encryptVolumesHandler);
95
+ // Register quota rule tools
96
+ mcpServer.registerTool(createQuotaRuleTool.name, createQuotaRuleTool, createQuotaRuleHandler);
97
+ mcpServer.registerTool(deleteQuotaRuleTool.name, deleteQuotaRuleTool, deleteQuotaRuleHandler);
98
+ mcpServer.registerTool(getQuotaRuleTool.name, getQuotaRuleTool, getQuotaRuleHandler);
99
+ mcpServer.registerTool(listQuotaRulesTool.name, listQuotaRulesTool, listQuotaRulesHandler);
100
+ mcpServer.registerTool(updateQuotaRuleTool.name, updateQuotaRuleTool, updateQuotaRuleHandler);
101
+ }
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Tool Registry for GCNV MCP Server
3
+ * Registers all available tools and their handlers
4
+ */
5
+ // Registry of all tools
6
+ export const toolRegistry = {};
7
+ // Map of tool names to handler functions
8
+ const toolHandlers = {};
9
+ /**
10
+ * Register a tool and its handler in the registry
11
+ */
12
+ export function registerTool(tool, handler) {
13
+ toolRegistry[tool.name] = tool;
14
+ toolHandlers[tool.name] = handler;
15
+ }
16
+ /**
17
+ * Get all tool definitions
18
+ */
19
+ export function getAllToolDefinitions() {
20
+ return Object.values(toolRegistry);
21
+ }
22
+ /**
23
+ * Get a handler function for a tool
24
+ */
25
+ export function getToolHandler(toolName) {
26
+ return toolHandlers[toolName];
27
+ }
@@ -0,0 +1,124 @@
1
+ import { z } from 'zod';
2
+ // Create Active Directory Tool
3
+ export const createActiveDirectoryTool = {
4
+ name: 'gcnv_active_directory_create',
5
+ title: 'Create Active Directory',
6
+ description: 'Creates a new active directory configuration',
7
+ inputSchema: {
8
+ projectId: z.string().describe('The ID of the Google Cloud project'),
9
+ location: z.string().describe('The location where the active directory should be created'),
10
+ activeDirectoryId: z.string().describe('The ID to assign to the active directory'),
11
+ domain: z.string().optional().describe('Domain name'),
12
+ site: z.string().optional().describe('Site name'),
13
+ dns: z.string().optional().describe('DNS server address'),
14
+ netBiosPrefix: z.string().optional().describe('NetBIOS prefix'),
15
+ organizationalUnit: z.string().optional().describe('Organizational unit'),
16
+ aesEncryption: z.boolean().optional().describe('Enable AES encryption'),
17
+ username: z.string().optional().describe('Username for domain join'),
18
+ password: z.string().optional().describe('Password for domain join'),
19
+ backupOperators: z.array(z.string()).optional().describe('List of backup operators'),
20
+ securityOperators: z.array(z.string()).optional().describe('List of security operators'),
21
+ kdcHostname: z.string().optional().describe('KDC hostname'),
22
+ kdcIp: z.string().optional().describe('KDC IP address'),
23
+ nfsUsersWithLdap: z.boolean().optional().describe('Enable NFS users with LDAP'),
24
+ description: z.string().optional().describe('Optional description'),
25
+ labels: z.record(z.string()).optional().describe('Optional labels'),
26
+ },
27
+ outputSchema: {
28
+ name: z.string().describe('The name of the created active directory'),
29
+ operationId: z.string().describe('The ID of the long-running operation'),
30
+ },
31
+ };
32
+ // Delete Active Directory Tool
33
+ export const deleteActiveDirectoryTool = {
34
+ name: 'gcnv_active_directory_delete',
35
+ title: 'Delete Active Directory',
36
+ description: 'Deletes an active directory configuration',
37
+ inputSchema: {
38
+ projectId: z.string().describe('The ID of the Google Cloud project'),
39
+ location: z.string().describe('The location of the active directory'),
40
+ activeDirectoryId: z.string().describe('The ID of the active directory to delete'),
41
+ },
42
+ outputSchema: {
43
+ success: z.boolean().describe('Whether the deletion was successful'),
44
+ operationId: z.string().optional().describe('The ID of the long-running operation'),
45
+ },
46
+ };
47
+ // Get Active Directory Tool
48
+ export const getActiveDirectoryTool = {
49
+ name: 'gcnv_active_directory_get',
50
+ title: 'Get Active Directory',
51
+ description: 'Gets details of a specific active directory',
52
+ inputSchema: {
53
+ projectId: z.string().describe('The ID of the Google Cloud project'),
54
+ location: z.string().describe('The location of the active directory'),
55
+ activeDirectoryId: z.string().describe('The ID of the active directory to retrieve'),
56
+ },
57
+ outputSchema: {
58
+ name: z.string().describe('The name of the active directory'),
59
+ activeDirectoryId: z.string().describe('The ID of the active directory'),
60
+ domain: z.string().optional().describe('Domain name'),
61
+ site: z.string().optional().describe('Site name'),
62
+ dns: z.string().optional().describe('DNS server address'),
63
+ state: z.string().optional().describe('The current state'),
64
+ createTime: z.date().optional().describe('The creation timestamp'),
65
+ description: z.string().optional().describe('Description'),
66
+ labels: z.record(z.string()).optional().describe('Labels'),
67
+ },
68
+ };
69
+ // List Active Directories Tool
70
+ export const listActiveDirectoriesTool = {
71
+ name: 'gcnv_active_directory_list',
72
+ title: 'List Active Directories',
73
+ description: 'Lists all active directories in the specified location',
74
+ inputSchema: {
75
+ projectId: z.string().describe('The ID of the Google Cloud project'),
76
+ location: z.string().describe('The location to list active directories from'),
77
+ filter: z.string().optional().describe('Filter expression'),
78
+ pageSize: z.number().optional().describe('Maximum number of items to return'),
79
+ pageToken: z.string().optional().describe('Page token from previous request'),
80
+ },
81
+ outputSchema: {
82
+ activeDirectories: z
83
+ .array(z.object({
84
+ name: z.string().describe('The name of the active directory'),
85
+ activeDirectoryId: z.string().describe('The ID of the active directory'),
86
+ domain: z.string().optional().describe('Domain name'),
87
+ site: z.string().optional().describe('Site name'),
88
+ state: z.string().optional().describe('The current state'),
89
+ createTime: z.date().optional().describe('The creation timestamp'),
90
+ }))
91
+ .describe('List of active directories'),
92
+ nextPageToken: z.string().optional().describe('Token for next page'),
93
+ },
94
+ };
95
+ // Update Active Directory Tool
96
+ export const updateActiveDirectoryTool = {
97
+ name: 'gcnv_active_directory_update',
98
+ title: 'Update Active Directory',
99
+ description: 'Updates an active directory configuration',
100
+ inputSchema: {
101
+ projectId: z.string().describe('The ID of the Google Cloud project'),
102
+ location: z.string().describe('The location of the active directory'),
103
+ activeDirectoryId: z.string().describe('The ID of the active directory to update'),
104
+ domain: z.string().optional().describe('Domain name'),
105
+ site: z.string().optional().describe('Site name'),
106
+ dns: z.string().optional().describe('DNS server address'),
107
+ netBiosPrefix: z.string().optional().describe('NetBIOS prefix'),
108
+ organizationalUnit: z.string().optional().describe('Organizational unit'),
109
+ aesEncryption: z.boolean().optional().describe('Enable AES encryption'),
110
+ username: z.string().optional().describe('Username for domain join'),
111
+ password: z.string().optional().describe('Password for domain join'),
112
+ backupOperators: z.array(z.string()).optional().describe('List of backup operators'),
113
+ securityOperators: z.array(z.string()).optional().describe('List of security operators'),
114
+ kdcHostname: z.string().optional().describe('KDC hostname'),
115
+ kdcIp: z.string().optional().describe('KDC IP address'),
116
+ nfsUsersWithLdap: z.boolean().optional().describe('Enable NFS users with LDAP'),
117
+ description: z.string().optional().describe('New description'),
118
+ labels: z.record(z.string()).optional().describe('New labels'),
119
+ },
120
+ outputSchema: {
121
+ name: z.string().describe('The name of the updated active directory'),
122
+ operationId: z.string().describe('The ID of the long-running operation'),
123
+ },
124
+ };
@@ -0,0 +1,140 @@
1
+ import { z } from 'zod';
2
+ // Create Backup Policy Tool
3
+ export const createBackupPolicyTool = {
4
+ name: 'gcnv_backup_policy_create',
5
+ title: 'Create Backup Policy',
6
+ description: 'Creates a new backup policy in the specified project and location',
7
+ inputSchema: {
8
+ projectId: z.string().describe('The ID of the Google Cloud project'),
9
+ location: z.string().describe('The location where the backup policy should be created'),
10
+ backupPolicyId: z.string().describe('The ID to assign to the backup policy'),
11
+ dailyBackupLimit: z.number().optional().describe('Maximum number of daily backups to keep'),
12
+ weeklyBackupLimit: z.number().optional().describe('Maximum number of weekly backups to keep'),
13
+ monthlyBackupLimit: z.number().optional().describe('Maximum number of monthly backups to keep'),
14
+ description: z.string().optional().describe('Optional description of the backup policy'),
15
+ enabled: z.boolean().optional().describe('Whether the backup policy is enabled'),
16
+ labels: z
17
+ .record(z.string())
18
+ .optional()
19
+ .describe('Optional labels to apply to the backup policy'),
20
+ },
21
+ outputSchema: {
22
+ name: z.string().describe('The name of the created backup policy'),
23
+ operationId: z
24
+ .string()
25
+ .describe('The ID of the long-running operation for creating the backup policy'),
26
+ },
27
+ };
28
+ // Delete Backup Policy Tool
29
+ export const deleteBackupPolicyTool = {
30
+ name: 'gcnv_backup_policy_delete',
31
+ title: 'Delete Backup Policy',
32
+ description: 'Deletes a backup policy in the specified project and location',
33
+ inputSchema: {
34
+ projectId: z.string().describe('The ID of the Google Cloud project'),
35
+ location: z.string().describe('The location of the backup policy'),
36
+ backupPolicyId: z.string().describe('The ID of the backup policy to delete'),
37
+ force: z
38
+ .boolean()
39
+ .optional()
40
+ .describe('Force deletion even if the policy is assigned to volumes'),
41
+ },
42
+ outputSchema: {
43
+ success: z.boolean().describe('Whether the deletion was successful'),
44
+ operationId: z.string().optional().describe('The ID of the long-running operation'),
45
+ },
46
+ };
47
+ // Get Backup Policy Tool
48
+ export const getBackupPolicyTool = {
49
+ name: 'gcnv_backup_policy_get',
50
+ title: 'Get Backup Policy',
51
+ description: 'Gets details of a specific backup policy',
52
+ inputSchema: {
53
+ projectId: z.string().describe('The ID of the Google Cloud project'),
54
+ location: z.string().describe('The location of the backup policy'),
55
+ backupPolicyId: z.string().describe('The ID of the backup policy to retrieve'),
56
+ },
57
+ outputSchema: {
58
+ name: z.string().describe('The fully qualified name of the backup policy'),
59
+ backupPolicyId: z.string().describe('The ID of the backup policy'),
60
+ dailyBackupLimit: z.number().optional().describe('Maximum number of daily backups to keep'),
61
+ weeklyBackupLimit: z.number().optional().describe('Maximum number of weekly backups to keep'),
62
+ monthlyBackupLimit: z.number().optional().describe('Maximum number of monthly backups to keep'),
63
+ description: z.string().optional().describe('Description of the backup policy'),
64
+ enabled: z.boolean().describe('Whether the backup policy is enabled'),
65
+ assignedVolumeCount: z
66
+ .number()
67
+ .optional()
68
+ .describe('Number of volumes assigned to this policy'),
69
+ state: z.string().describe('The current state of the backup policy'),
70
+ createTime: z.date().describe('The creation time of the backup policy'),
71
+ labels: z.record(z.string()).optional().describe('Labels applied to the backup policy'),
72
+ },
73
+ };
74
+ // List Backup Policies Tool
75
+ export const listBackupPoliciesTool = {
76
+ name: 'gcnv_backup_policy_list',
77
+ title: 'List Backup Policies',
78
+ description: 'Lists backup policies in a specific project and location',
79
+ inputSchema: {
80
+ projectId: z.string().describe('The ID of the Google Cloud project'),
81
+ location: z.string().describe('The location to list backup policies from'),
82
+ filter: z.string().optional().describe('Filter expression for filtering results'),
83
+ pageSize: z
84
+ .number()
85
+ .optional()
86
+ .describe('Maximum number of backup policies to return per page'),
87
+ pageToken: z.string().optional().describe('Page token from a previous list request'),
88
+ },
89
+ outputSchema: {
90
+ backupPolicies: z
91
+ .array(z.object({
92
+ name: z.string().describe('The fully qualified name of the backup policy'),
93
+ backupPolicyId: z.string().describe('The ID of the backup policy'),
94
+ dailyBackupLimit: z
95
+ .number()
96
+ .optional()
97
+ .describe('Maximum number of daily backups to keep'),
98
+ weeklyBackupLimit: z
99
+ .number()
100
+ .optional()
101
+ .describe('Maximum number of weekly backups to keep'),
102
+ monthlyBackupLimit: z
103
+ .number()
104
+ .optional()
105
+ .describe('Maximum number of monthly backups to keep'),
106
+ description: z.string().optional().describe('Description of the backup policy'),
107
+ enabled: z.boolean().describe('Whether the backup policy is enabled'),
108
+ assignedVolumeCount: z
109
+ .number()
110
+ .optional()
111
+ .describe('Number of volumes assigned to this policy'),
112
+ state: z.string().describe('The current state of the backup policy'),
113
+ createTime: z.date().optional().describe('The creation time of the backup policy'),
114
+ labels: z.record(z.string()).optional().describe('Labels applied to the backup policy'),
115
+ }))
116
+ .describe('List of backup policies'),
117
+ nextPageToken: z.string().optional().describe('Token for fetching the next page'),
118
+ },
119
+ };
120
+ // Update Backup Policy Tool
121
+ export const updateBackupPolicyTool = {
122
+ name: 'gcnv_backup_policy_update',
123
+ title: 'Update Backup Policy',
124
+ description: 'Updates the properties of an existing backup policy',
125
+ inputSchema: {
126
+ projectId: z.string().describe('The ID of the Google Cloud project'),
127
+ location: z.string().describe('The location of the backup policy'),
128
+ backupPolicyId: z.string().describe('The ID of the backup policy to update'),
129
+ dailyBackupLimit: z.number().optional().describe('Maximum number of daily backups to keep'),
130
+ weeklyBackupLimit: z.number().optional().describe('Maximum number of weekly backups to keep'),
131
+ monthlyBackupLimit: z.number().optional().describe('Maximum number of monthly backups to keep'),
132
+ description: z.string().optional().describe('New description for the backup policy'),
133
+ enabled: z.boolean().optional().describe('Whether the backup policy is enabled'),
134
+ labels: z.record(z.string()).optional().describe('New labels to apply to the backup policy'),
135
+ },
136
+ outputSchema: {
137
+ name: z.string().describe('The fully qualified name of the updated backup policy'),
138
+ operationId: z.string().describe('The ID of the long-running operation'),
139
+ },
140
+ };
@@ -0,0 +1,178 @@
1
+ import { z } from 'zod';
2
+ // Create Backup Tool
3
+ export const createBackupTool = {
4
+ name: 'gcnv_backup_create',
5
+ title: 'Create Backup',
6
+ description: 'Creates a new backup of a volume in the specified backup vault',
7
+ inputSchema: {
8
+ projectId: z.string().describe('The ID of the Google Cloud project'),
9
+ location: z.string().describe('The location where the backup should be created'),
10
+ backupVaultId: z.string().describe('The ID of the backup vault to store the backup'),
11
+ backupId: z.string().describe('The ID to assign to the backup'),
12
+ backupRegion: z.string().optional().describe('The region where the backup will be stored'),
13
+ enforcedRetentionEndTime: z
14
+ .number()
15
+ .optional()
16
+ .describe('The number of days to retain the backup'),
17
+ sourceVolumeName: z
18
+ .string()
19
+ .describe('The full name of the volume to back up (projects/{project}/locations/{location}/storagePools/{storage_pool}/volumes/{volume})'),
20
+ description: z.string().optional().describe('Optional description of the backup'),
21
+ labels: z.record(z.string()).optional().describe('Optional labels to apply to the backup'),
22
+ },
23
+ outputSchema: {
24
+ name: z.string().describe('The name of the created backup'),
25
+ operationId: z
26
+ .string()
27
+ .describe('The ID of the long-running operation for creating the backup'),
28
+ },
29
+ };
30
+ // Delete Backup Tool
31
+ export const deleteBackupTool = {
32
+ name: 'gcnv_backup_delete',
33
+ title: 'Delete Backup',
34
+ description: 'Deletes a backup from the specified backup vault',
35
+ inputSchema: {
36
+ projectId: z.string().describe('The ID of the Google Cloud project'),
37
+ location: z.string().describe('The location of the backup'),
38
+ backupVaultId: z.string().describe('The ID of the backup vault containing the backup'),
39
+ backupId: z.string().describe('The ID of the backup to delete'),
40
+ },
41
+ outputSchema: {
42
+ success: z.boolean().describe('Whether the deletion was successful'),
43
+ operationId: z.string().optional().describe('The ID of the long-running operation'),
44
+ },
45
+ };
46
+ // Get Backup Tool
47
+ export const getBackupTool = {
48
+ name: 'gcnv_backup_get',
49
+ title: 'Get Backup',
50
+ description: 'Gets details of a specific backup',
51
+ inputSchema: {
52
+ projectId: z.string().describe('The ID of the Google Cloud project'),
53
+ location: z.string().describe('The location of the backup'),
54
+ backupVaultId: z.string().describe('The ID of the backup vault containing the backup'),
55
+ backupId: z.string().describe('The ID of the backup to retrieve'),
56
+ },
57
+ outputSchema: {
58
+ name: z.string().describe('The fully qualified name of the backup'),
59
+ backupId: z.string().describe('The ID of the backup'),
60
+ backupVaultId: z.string().describe('The ID of the backup vault containing the backup'),
61
+ state: z.string().describe('The current state of the backup'),
62
+ description: z.string().optional().describe('Description of the backup'),
63
+ volumeUsagebytes: z.number().optional().describe('The size of the volume in bytes'),
64
+ backupType: z.string().optional().describe('The type of the backup'),
65
+ sourceVolume: z.string().describe('The name of the source volume'),
66
+ createTime: z.date().optional().describe('The creation time of the backup'),
67
+ chainStoragebytes: z.number().optional().describe('The size of the backup chain in bytes'),
68
+ satisfiesPzs: z.boolean().optional().describe('Whether the backup satisfies PZS requirements'),
69
+ satisfiesPzi: z.boolean().optional().describe('Whether the backup satisfies PZI requirements'),
70
+ volumeRegion: z.string().optional().describe('The region of the source volume'),
71
+ backupRegion: z.string().optional().describe('The region where the backup is stored'),
72
+ enforcedRetentionEndTime: z
73
+ .number()
74
+ .optional()
75
+ .describe('The number of days the backup is retained'),
76
+ sourceSnapshot: z
77
+ .string()
78
+ .optional()
79
+ .describe('The name of the source snapshot if the backup was created from a snapshot'),
80
+ labels: z.record(z.string()).optional().describe('Labels applied to the backup'),
81
+ },
82
+ };
83
+ // List Backups Tool
84
+ export const listBackupsTool = {
85
+ name: 'gcnv_backup_list',
86
+ title: 'List Backups',
87
+ description: 'Lists backups in a specific backup vault',
88
+ inputSchema: {
89
+ projectId: z.string().describe('The ID of the Google Cloud project'),
90
+ location: z.string().describe('The location to list backups from'),
91
+ backupVaultId: z.string().describe('The ID of the backup vault containing the backups'),
92
+ filter: z.string().optional().describe('Filter expression for filtering results'),
93
+ pageSize: z.number().optional().describe('Maximum number of backups to return per page'),
94
+ pageToken: z.string().optional().describe('Page token from a previous list request'),
95
+ },
96
+ outputSchema: {
97
+ backups: z
98
+ .array(z.object({
99
+ name: z.string().describe('The fully qualified name of the backup'),
100
+ backupId: z.string().describe('The ID of the backup'),
101
+ backupVaultId: z.string().describe('The ID of the backup vault containing the backup'),
102
+ state: z.string().describe('The current state of the backup'),
103
+ description: z.string().optional().describe('Description of the backup'),
104
+ volumeUsagebytes: z.number().optional().describe('The size of the volume in bytes'),
105
+ backupType: z.string().optional().describe('The type of the backup'),
106
+ sourceVolume: z.string().describe('The name of the source volume'),
107
+ createTime: z.date().optional().describe('The creation time of the backup'),
108
+ chainStoragebytes: z
109
+ .number()
110
+ .optional()
111
+ .describe('The size of the backup chain in bytes'),
112
+ satisfiesPzs: z
113
+ .boolean()
114
+ .optional()
115
+ .describe('Whether the backup satisfies PZS requirements'),
116
+ satisfiesPzi: z
117
+ .boolean()
118
+ .optional()
119
+ .describe('Whether the backup satisfies PZI requirements'),
120
+ volumeRegion: z.string().optional().describe('The region of the source volume'),
121
+ backupRegion: z.string().optional().describe('The region where the backup is stored'),
122
+ enforcedRetentionEndTime: z
123
+ .number()
124
+ .optional()
125
+ .describe('The number of days the backup is retained'),
126
+ sourceSnapshot: z
127
+ .string()
128
+ .optional()
129
+ .describe('The name of the source snapshot if the backup was created from a snapshot'),
130
+ labels: z.record(z.string()).optional().describe('Labels applied to the backup'),
131
+ }))
132
+ .describe('List of backups'),
133
+ nextPageToken: z.string().optional().describe('Token for fetching the next page'),
134
+ },
135
+ };
136
+ // Restore Backup Tool
137
+ export const restoreBackupTool = {
138
+ name: 'gcnv_backup_restore',
139
+ title: 'Restore Backup',
140
+ description: 'Restores a backup to a new or existing volume',
141
+ inputSchema: {
142
+ projectId: z.string().describe('The ID of the Google Cloud project'),
143
+ location: z.string().describe('The location of the backup'),
144
+ backupVaultId: z.string().describe('The ID of the backup vault containing the backup'),
145
+ backupId: z.string().describe('The ID of the backup to restore'),
146
+ targetStoragePoolId: z.string().describe('The ID of the storage pool to restore to'),
147
+ targetVolumeId: z.string().describe('The ID of the target volume to create or overwrite'),
148
+ restoreOption: z
149
+ .enum(['CREATE_NEW_VOLUME', 'OVERWRITE_EXISTING_VOLUME'])
150
+ .describe('Whether to create a new volume or overwrite an existing one'),
151
+ },
152
+ outputSchema: {
153
+ name: z.string().describe('The name of the target volume'),
154
+ operationId: z
155
+ .string()
156
+ .describe('The ID of the long-running operation for restoring the backup'),
157
+ },
158
+ };
159
+ // Update Backup Tool
160
+ export const updateBackupTool = {
161
+ name: 'gcnv_backup_update',
162
+ title: 'Update Backup',
163
+ description: 'Updates a backup with full spec',
164
+ inputSchema: {
165
+ projectId: z.string().describe('The ID of the Google Cloud project'),
166
+ location: z.string().describe('The location of the backup'),
167
+ backupVaultId: z.string().describe('The ID of the backup vault containing the backup'),
168
+ backupId: z.string().describe('The ID of the backup to update'),
169
+ description: z.string().optional().describe('New description of the backup'),
170
+ labels: z.record(z.string()).optional().describe('New labels to apply to the backup'),
171
+ },
172
+ outputSchema: {
173
+ name: z.string().describe('The name of the updated backup'),
174
+ operationId: z
175
+ .string()
176
+ .describe('The ID of the long-running operation for updating the backup'),
177
+ },
178
+ };