Skip to main content
Glama

list_oci_profiles

Retrieve available Oracle Cloud Infrastructure profiles from configuration files to select appropriate credentials before making API calls.

Instructions

List all available OCI profiles from ~/.oci/config file.

Returns a list of profiles with their configuration details.
Use this when you need to select a profile before making OCI API calls.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The MCP tool handler for 'list_oci_profiles', including registration decorator. Calls list_available_profiles helper and provides user feedback via ctx.info/error.
    @mcp.tool(name="list_oci_profiles")
    async def list_profiles_tool(ctx: Context) -> List[Dict[str, str]]:
        """
        List all available OCI profiles from ~/.oci/config file.
    
        Returns a list of profiles with their configuration details.
        Use this when you need to select a profile before making OCI API calls.
        """
        try:
            await ctx.info("Reading available OCI profiles from config file...")
            profiles = list_available_profiles()
    
            if not profiles:
                await ctx.info("No profiles found in OCI config file")
                return [{
                    "error": "No profiles found in OCI config file. Please configure OCI CLI first."
                }]
    
            await ctx.info(f"Found {len(profiles)} available profiles")
            return profiles
        except FileNotFoundError as e:
            error_msg = str(e)
            await ctx.error(error_msg)
            return [{"error": error_msg}]
        except Exception as e:
            error_msg = f"Error listing profiles: {str(e)}"
            await ctx.error(error_msg)
            logger.exception("Error listing OCI profiles")
            return [{"error": error_msg}]
  • Core helper function that implements the logic to parse ~/.oci/config file using configparser and extract profile details (name, user OCID, tenancy OCID, region, key fingerprint).
    def list_available_profiles() -> List[Dict[str, str]]:
        """
        List all available profiles from the OCI config file.
    
        Returns:
            List of dictionaries containing profile information:
            [
                {
                    "name": "DEFAULT",
                    "user": "ocid1.user...",
                    "tenancy": "ocid1.tenancy...",
                    "region": "us-ashburn-1",
                    "fingerprint": "aa:bb:cc:..."
                },
                ...
            ]
    
        Raises:
            FileNotFoundError: If OCI config file doesn't exist
            Exception: If config file cannot be parsed
        """
        config_path = get_oci_config_path()
    
        if not os.path.exists(config_path):
            raise FileNotFoundError(
                f"OCI config file not found at {config_path}. "
                f"Please create it or set OCI_CONFIG_FILE environment variable."
            )
    
        try:
            config = configparser.ConfigParser()
            config.read(config_path)
    
            profiles = []
            for section in config.sections():
                profile_info = {
                    "name": section,
                    "user": config.get(section, "user", fallback="N/A"),
                    "tenancy": config.get(section, "tenancy", fallback="N/A"),
                    "region": config.get(section, "region", fallback="N/A"),
                    "fingerprint": config.get(section, "fingerprint", fallback="N/A"),
                }
                profiles.append(profile_info)
    
            logger.info(f"Found {len(profiles)} profiles in {config_path}")
            return profiles
    
        except Exception as e:
            logger.exception(f"Error parsing OCI config file: {e}")
            raise Exception(f"Failed to parse OCI config file at {config_path}: {str(e)}")
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden. It discloses key behavioral traits: it reads from a specific file (~/.oci/config), returns a list with configuration details, and implies it's a read-only operation (listing). However, it doesn't mention potential errors (e.g., if the file is missing) or format of returned details, leaving some gaps.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is perfectly front-loaded and concise: three sentences with zero waste. The first sentence states the purpose, the second describes the return value, and the third provides usage guidelines—each earning its place efficiently.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's low complexity (0 parameters, no output schema, no annotations), the description is mostly complete. It covers purpose, return value, and usage context. However, it lacks details on error handling or exact return format, which could be helpful for an agent, though not critical for this simple tool.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The tool has 0 parameters with 100% schema description coverage, so the baseline is 4. The description adds no parameter information (as there are none), which is appropriate and doesn't detract from the score.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the specific verb ('List') and resource ('OCI profiles from ~/.oci/config file'), and distinguishes this tool from siblings like 'get_current_oci_profile' and 'set_oci_profile' by focusing on listing all available profiles rather than getting/setting a specific one. It explicitly mentions the source file and what is returned.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides explicit guidance on when to use this tool: 'Use this when you need to select a profile before making OCI API calls.' This directly addresses the tool's purpose in the workflow and distinguishes it from other tools that perform OCI operations after profile selection.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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