Skip to main content
Glama

get_key

Retrieve detailed encryption key information from Oracle Cloud Infrastructure, including algorithm, shape, and version details for security management.

Instructions

Get detailed information about a specific encryption key.

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

Args:
    key_id: OCID of the key to retrieve
    management_endpoint: Management endpoint from the vault (get from vault details)

Returns:
    Detailed key information including algorithm, shape, and versions

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
key_idYes
management_endpointYes

Implementation Reference

  • MCP tool registration and handler for 'get_key'. This async function is decorated with @mcp.tool(name='get_key') and handles the tool execution by calling the underlying helper with OCI config and parameters.
    @mcp.tool(name="get_key")
    @mcp_tool_wrapper(
        start_msg="Getting encryption key details for {key_id}...",
        success_msg="Retrieved key details successfully",
        error_prefix="Error getting key details"
    )
    async def mcp_get_key(ctx: Context, key_id: str, management_endpoint: str) -> Dict[str, Any]:
        """
        Get detailed information about a specific encryption key.
    
        Note: You must first get a vault to obtain its management_endpoint.
    
        Args:
            key_id: OCID of the key to retrieve
            management_endpoint: Management endpoint from the vault (get from vault details)
    
        Returns:
            Detailed key information including algorithm, shape, and versions
        """
        return get_key(oci_clients["config"], management_endpoint, key_id)
  • Core helper function implementing the OCI KMS key retrieval logic. Creates a KMSManagementClient using the vault's management endpoint and fetches/formats key details.
    def get_key(config: dict, management_endpoint: str, key_id: str) -> Dict[str, Any]:
        """
        Get details of a specific key.
    
        Args:
            config: OCI config dict
            management_endpoint: Management endpoint from the vault
            key_id: OCID of the key
    
        Returns:
            Details of the key
        """
        try:
            # Create KMS Management client with the vault's management endpoint
            kms_management_client = oci.key_management.KmsManagementClient(config, service_endpoint=management_endpoint)
    
            key = kms_management_client.get_key(key_id).data
    
            key_details = {
                "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,
                "current_key_version": key.current_key_version,
                "key_shape": {
                    "algorithm": key.key_shape.algorithm if key.key_shape else None,
                    "length": key.key_shape.length if key.key_shape else None,
                    "curve_id": key.key_shape.curve_id if key.key_shape else None,
                } if key.key_shape else None,
                "is_primary": key.is_primary,
                "replica_details": {
                    "replication_id": key.replica_details.replication_id if key.replica_details else None,
                } if key.replica_details else None,
            }
    
            logger.info(f"Retrieved details for key {key_id}")
            return key_details
    
        except Exception as e:
            logger.exception(f"Error getting key details: {e}")
            raise
  • Import statement registering the get_key helper function from the security tools module for use in the MCP server.
    from mcp_server_oci.tools.security import (
        list_security_lists,
        get_security_list,
        list_network_security_groups,
        get_network_security_group,
        list_vaults,
        get_vault,
        list_keys,
        get_key,
    )
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 action ('Get detailed information') and mentions the return format ('including algorithm, shape, and versions'), which adds value. However, it lacks details on permissions, rate limits, or error conditions that would be helpful for a tool accessing encryption keys.

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 well-structured and front-loaded with the core purpose, followed by a prerequisite note and clear sections for Args and Returns. Every sentence adds value without redundancy, making it efficient and easy to parse.

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

Completeness3/5

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

Given no annotations and no output schema, the description does a decent job covering purpose, parameters, and return information. However, for a tool dealing with encryption keys, more behavioral context (e.g., security implications, error handling) would improve completeness, especially with 2 required parameters and no structured output documentation.

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?

Schema description coverage is 0%, so the description must compensate. It explains both parameters: 'key_id: OCID of the key to retrieve' and 'management_endpoint: Management endpoint from the vault (get from vault details)'. This adds clear meaning beyond the schema's minimal titles, though it doesn't specify formats or constraints.

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

Purpose4/5

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

The description clearly states the tool's purpose: 'Get detailed information about a specific encryption key.' It uses a specific verb ('Get') and identifies the resource ('encryption key'), but doesn't explicitly differentiate from sibling tools like 'list_keys' or 'get_vault' beyond the specificity of retrieving a single key.

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 for usage with the note: 'You must first get a vault to obtain its management_endpoint.' This indicates a prerequisite and workflow guidance. However, it doesn't explicitly mention when to use this versus alternatives like 'list_keys' or other sibling tools.

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