get_namespace
Retrieve the unique Object Storage namespace identifier required for all storage operations in Oracle Cloud Infrastructure tenancies.
Instructions
Get the Object Storage namespace for the tenancy.
The namespace is a unique identifier for the tenancy in Object Storage.
It's required for all Object Storage operations.
Returns:
Dictionary with namespace information
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- The core handler function that executes the 'get_namespace' tool logic. It retrieves the Object Storage namespace using the provided OCI client and returns it wrapped in a dictionary.def get_namespace(object_storage_client: oci.object_storage.ObjectStorageClient) -> Dict[str, Any]: """ Get the Object Storage namespace for the tenancy. Args: object_storage_client: OCI ObjectStorage client Returns: Object Storage namespace details """ try: namespace = object_storage_client.get_namespace().data namespace_details = { "namespace": namespace, } logger.info(f"Retrieved Object Storage namespace: {namespace}") return namespace_details except Exception as e: logger.exception(f"Error getting namespace: {e}") raise
- mcp_server_oci/mcp_server.py:795-812 (registration)Registers the MCP tool named 'get_namespace' by decorating the wrapper function that calls the core handler from resources.py, adding logging and error handling.@mcp.tool(name="get_namespace") @mcp_tool_wrapper( start_msg="Getting Object Storage namespace...", success_msg="Retrieved namespace successfully", error_prefix="Error getting namespace" ) async def mcp_get_namespace(ctx: Context) -> Dict[str, Any]: """ Get the Object Storage namespace for the tenancy. The namespace is a unique identifier for the tenancy in Object Storage. It's required for all Object Storage operations. Returns: Dictionary with namespace information """ return get_namespace(oci_clients["object_storage"])
- mcp_server_oci/mcp_server.py:87-96 (registration)Imports the get_namespace handler function from tools.resources module for use in tool registration.from mcp_server_oci.tools.resources import ( list_availability_domains, list_fault_domains, list_images, get_image, list_shapes, get_namespace, list_regions, get_tenancy_info, )