Skip to main content
Glama

get_tenancy_info

Retrieve tenancy details including name, home region, and description by providing the tenancy OCID.

Instructions

Get detailed information about a tenancy.

Args:
    tenancy_id: OCID of the tenancy

Returns:
    Tenancy details including name, home region, and description

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
tenancy_idYes

Implementation Reference

  • Core implementation of the get_tenancy_info tool handler. Fetches tenancy details using OCI IdentityClient.get_tenancy() and formats the response.
    def get_tenancy_info(identity_client: oci.identity.IdentityClient, tenancy_id: str) -> Dict[str, Any]:
        """
        Get tenancy information.
        
        Args:
            identity_client: OCI Identity client
            tenancy_id: OCID of the tenancy
            
        Returns:
            Tenancy details
        """
        try:
            tenancy = identity_client.get_tenancy(tenancy_id).data
            
            tenancy_details = {
                "id": tenancy.id,
                "name": tenancy.name,
                "description": tenancy.description,
                "home_region_key": tenancy.home_region_key,
                "upi_idcs_compatibility_layer_endpoint": tenancy.upi_idcs_compatibility_layer_endpoint,
            }
            
            logger.info(f"Retrieved tenancy details for {tenancy_id}")
            return tenancy_details
            
        except Exception as e:
            logger.exception(f"Error getting tenancy details: {e}")
            raise
  • MCP tool registration using @mcp.tool(name='get_tenancy_info') decorator. Wraps the core handler with standardized error handling, logging, and profile management via mcp_tool_wrapper.
    @mcp.tool(name="get_tenancy_info")
    @mcp_tool_wrapper(
        start_msg="Getting tenancy information for {tenancy_id}...",
        success_msg="Retrieved tenancy information successfully",
        error_prefix="Error getting tenancy information"
    )
    async def mcp_get_tenancy_info(ctx: Context, tenancy_id: str) -> Dict[str, Any]:
        """
        Get detailed information about a tenancy.
    
        Args:
            tenancy_id: OCID of the tenancy
    
        Returns:
            Tenancy details including name, home region, and description
        """
        return get_tenancy_info(oci_clients["identity"], tenancy_id)

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