oci-manage
Manage Oracle Cloud Infrastructure resources including compute, storage, networking, databases, and monitoring through a unified interface.
Instructions
Manage Oracle Cloud Infrastructure resources including compute, storage, networking, databases, and monitoring.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| service | Yes | The OCI service to interact with | |
| action | Yes | The action to perform | |
| resourceType | Yes | The type of resource (e.g., instances, buckets, vcns) | |
| resourceId | No | The OCID of the resource (for specific operations) | |
| compartmentId | No | The compartment OCID (optional, defaults to tenancy) | |
| parameters | No | Additional parameters for the operation |
Implementation Reference
- src/simple-index.ts:112-184 (handler)The primary handler function for the 'oci-manage' tool. It validates input parameters, checks for required OCI environment variables, returns credential setup help if missing, and provides a mock response indicating the intended OCI operation.private async handleOCIManage(args: any) { // Basic validation if (!args.service || !args.action || !args.resourceType) { throw new McpError( ErrorCode.InvalidParams, 'Missing required parameters: service, action, resourceType' ); } // Check if OCI credentials are configured const requiredEnvVars = [ 'OCI_TENANCY_ID', 'OCI_USER_ID', 'OCI_KEY_FINGERPRINT', 'OCI_PRIVATE_KEY_PATH', 'OCI_REGION' ]; const missingVars = requiredEnvVars.filter(varName => !process.env[varName]); if (missingVars.length > 0) { return { content: [ { type: 'text', text: JSON.stringify({ success: false, message: `OCI credentials not configured. Please set the following environment variables: ${missingVars.join(', ')}`, help: { setup: 'Configure OCI authentication by setting environment variables', variables: { OCI_TENANCY_ID: 'Your OCI tenancy OCID', OCI_USER_ID: 'Your OCI user OCID', OCI_KEY_FINGERPRINT: 'Your API key fingerprint', OCI_PRIVATE_KEY_PATH: 'Path to your private key file', OCI_REGION: 'Your preferred OCI region (e.g., us-ashburn-1)' }, example: { service: 'compute', action: 'list', resourceType: 'instances', compartmentId: 'ocid1.compartment.oc1..aaaaaaaa...' } } }, null, 2) } ] }; } // For now, return a mock response indicating the operation would be performed const response = { success: true, service: args.service, action: args.action, resourceType: args.resourceType, resourceId: args.resourceId, compartmentId: args.compartmentId || process.env.OCI_COMPARTMENT_ID || process.env.OCI_TENANCY_ID, message: `Would ${args.action} ${args.resourceType} in ${args.service} service`, note: 'This is a placeholder response. Full OCI integration requires the complete implementation.', credentials_configured: true, region: process.env.OCI_REGION }; return { content: [ { type: 'text', text: JSON.stringify(response, null, 2) } ] }; }
- src/simple-index.ts:47-78 (schema)Defines the input schema for the 'oci-manage' tool, including properties for service, action, resourceType (required), and optional fields like resourceId, compartmentId, and parameters.inputSchema: { type: 'object', properties: { service: { type: 'string', enum: ['compute', 'storage', 'network', 'database', 'monitoring', 'identity'], description: 'The OCI service to interact with' }, action: { type: 'string', enum: ['list', 'get', 'create', 'update', 'delete', 'start', 'stop'], description: 'The action to perform' }, resourceType: { type: 'string', description: 'The type of resource (e.g., instances, buckets, vcns)' }, resourceId: { type: 'string', description: 'The OCID of the resource (for specific operations)' }, compartmentId: { type: 'string', description: 'The compartment OCID (optional, defaults to tenancy)' }, parameters: { type: 'object', description: 'Additional parameters for the operation' } }, required: ['service', 'action', 'resourceType'] }
- src/simple-index.ts:42-82 (registration)Registers the 'oci-manage' tool in the ListTools response, providing its name, description, and input schema.return { tools: [ { name: 'oci-manage', description: 'Manage Oracle Cloud Infrastructure resources including compute, storage, networking, databases, and monitoring.', inputSchema: { type: 'object', properties: { service: { type: 'string', enum: ['compute', 'storage', 'network', 'database', 'monitoring', 'identity'], description: 'The OCI service to interact with' }, action: { type: 'string', enum: ['list', 'get', 'create', 'update', 'delete', 'start', 'stop'], description: 'The action to perform' }, resourceType: { type: 'string', description: 'The type of resource (e.g., instances, buckets, vcns)' }, resourceId: { type: 'string', description: 'The OCID of the resource (for specific operations)' }, compartmentId: { type: 'string', description: 'The compartment OCID (optional, defaults to tenancy)' }, parameters: { type: 'object', description: 'Additional parameters for the operation' } }, required: ['service', 'action', 'resourceType'] } } ] }; });
- src/simple-index.ts:89-92 (registration)Registers the handler dispatch for 'oci-manage' tool calls within the CallToolRequestHandler switch statement.switch (name) { case 'oci-manage': return await this.handleOCIManage(args); default: