Skip to main content
Glama

list_keys

Retrieve all encryption keys stored in an Oracle Cloud vault compartment to manage cryptographic assets and their configurations.

Instructions

List all encryption keys in a vault's compartment.

Note: You must first get a vault to obtain its management_endpoint.

Args:
    compartment_id: OCID of the compartment
    management_endpoint: Management endpoint from the vault (get from vault details)

Returns:
    List of keys with their algorithm, protection mode, and state

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
compartment_idYes
management_endpointYes

Implementation Reference

  • MCP tool handler function 'mcp_list_keys' decorated with @mcp.tool(name='list_keys'). It calls the helper list_keys with OCI config and parameters.
    @mcp.tool(name="list_keys")
    @mcp_tool_wrapper(
        start_msg="Listing encryption keys in vault...",
        error_prefix="Error listing keys"
    )
    async def mcp_list_keys(ctx: Context, compartment_id: str, management_endpoint: str) -> List[Dict[str, Any]]:
        """
        List all encryption keys in a vault's compartment.
    
        Note: You must first get a vault to obtain its management_endpoint.
    
        Args:
            compartment_id: OCID of the compartment
            management_endpoint: Management endpoint from the vault (get from vault details)
    
        Returns:
            List of keys with their algorithm, protection mode, and state
        """
        return list_keys(oci_clients["config"], management_endpoint, compartment_id)
  • Core helper function 'list_keys' that creates OCI KmsManagementClient and lists keys using OCI pagination, formatting the response.
    def list_keys(config: dict, management_endpoint: str, compartment_id: str) -> List[Dict[str, Any]]:
        """
        List all keys in a vault's compartment.
    
        Args:
            config: OCI config dict
            management_endpoint: Management endpoint from the vault
            compartment_id: OCID of the compartment
    
        Returns:
            List of keys with their details
        """
        try:
            # Create KMS Management client with the vault's management endpoint
            kms_management_client = oci.key_management.KmsManagementClient(config, service_endpoint=management_endpoint)
    
            keys_response = oci.pagination.list_call_get_all_results(
                kms_management_client.list_keys,
                compartment_id
            )
    
            keys = []
            for key in keys_response.data:
                keys.append({
                    "id": key.id,
                    "display_name": key.display_name,
                    "compartment_id": key.compartment_id,
                    "lifecycle_state": key.lifecycle_state,
                    "time_created": str(key.time_created),
                    "vault_id": key.vault_id,
                    "protection_mode": key.protection_mode,
                    "algorithm": key.algorithm,
                })
    
            logger.info(f"Found {len(keys)} keys in compartment {compartment_id}")
            return keys
    
        except Exception as e:
            logger.exception(f"Error listing keys: {e}")
            raise
Behavior3/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 describes the operation as a list/read action (implied non-destructive) and mentions the prerequisite of obtaining management_endpoint, but lacks details on permissions, rate limits, pagination, or error conditions that would be important for a cloud resource tool.

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 efficiently structured with a clear purpose statement, important prerequisite note, and separate Args/Returns sections. Every sentence adds value without redundancy, making it easy to parse.

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?

For a 2-parameter tool with no annotations and no output schema, the description does well by explaining parameters and return format. However, it could provide more behavioral context about the list operation (e.g., pagination, sorting, filtering) given the complexity of cloud resource management.

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

Parameters5/5

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

The description adds significant value beyond the 0% schema coverage. It explains that 'compartment_id' is an OCID and 'management_endpoint' comes from vault details, clarifying the purpose and source of both parameters that the bare schema titles don't provide.

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 verb 'List' and resource 'encryption keys in a vault's compartment', specifying the scope precisely. It distinguishes from siblings like 'get_key' (singular retrieval) and 'list_vaults' (different resource type), making the purpose unambiguous.

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

Usage Guidelines4/5

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

The description provides clear context with the note about obtaining the management_endpoint from a vault first, which is a prerequisite. However, it doesn't explicitly state when to use this tool versus alternatives like 'get_key' or other list tools, missing sibling differentiation.

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