Skip to main content
Glama

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
NameRequiredDescriptionDefault

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
  • 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"])
  • 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,
    )

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/jopsis/mcp-server-oci'

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