Skip to main content
Glama

list_old_access_keys

Identify AWS IAM access keys exceeding a specified age threshold to help maintain security by detecting potentially unused credentials.

Instructions

Lists access keys older than 90 days (or specified days).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
daysNoNumber of days threshold (default: 90).

Implementation Reference

  • src/index.ts:358-370 (registration)
    Registers the 'list_old_access_keys' tool, including its schema for input validation (optional 'days' parameter).
    {
        name: "list_old_access_keys",
        description: "Lists access keys older than 90 days (or specified days).",
        inputSchema: {
            type: "object",
            properties: {
                days: {
                    type: "number",
                    description: "Number of days threshold (default: 90)."
                }
            }
        }
    },
  • Executes the tool logic: iterates over IAM users, lists their access keys using IAMClient, filters active keys older than threshold, computes days old, returns JSON list.
    if (name === "list_old_access_keys") {
        const days = (args as any)?.days || 90;
        const thresholdDate = new Date(Date.now() - days * 24 * 60 * 60 * 1000);
    
        const listCmd = new ListUsersCommand({});
        const listResp = await iamClient.send(listCmd);
        const users = listResp.Users || [];
    
        const oldKeys = [];
    
        for (const user of users) {
            if (!user.UserName) continue;
            try {
                const keysCmd = new ListAccessKeysCommand({ UserName: user.UserName });
                const keysResp = await iamClient.send(keysCmd);
    
                if (keysResp.AccessKeyMetadata) {
                    for (const key of keysResp.AccessKeyMetadata) {
                        if (key.CreateDate && key.CreateDate < thresholdDate && key.Status === "Active") {
                            oldKeys.push({
                                UserName: user.UserName,
                                AccessKeyId: key.AccessKeyId,
                                CreateDate: key.CreateDate,
                                Status: key.Status,
                                DaysOld: Math.floor((Date.now() - key.CreateDate.getTime()) / (1000 * 60 * 60 * 24))
                            });
                        }
                    }
                }
            } catch (err) {
                // Ignore
            }
        }
    
        return {
            content: [{ type: "text", text: JSON.stringify(oldKeys, null, 2) }]
        };
    }
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool lists access keys based on an age threshold, but doesn't cover critical aspects like whether this is a read-only operation, if it requires specific IAM permissions, what the output format looks like, or if there are rate limits. For a tool with zero annotation coverage, this is a significant gap in transparency.

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 a single, efficient sentence: 'Lists access keys older than 90 days (or specified days).' It's front-loaded with the core purpose and includes the key detail about the parameter, with zero wasted words. This makes it easy for an agent to parse quickly.

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

Completeness2/5

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

Given the lack of annotations and output schema, the description is incomplete. It doesn't explain what the output contains (e.g., key IDs, creation dates, associated users), behavioral traits like safety or permissions, or usage context. For a tool that likely interacts with IAM and could have security implications, this leaves significant gaps for an agent to operate effectively.

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

Parameters3/5

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

The input schema has 100% description coverage, with the 'days' parameter clearly documented as 'Number of days threshold (default: 90).' The description adds minimal value by mentioning '90 days (or specified days),' which aligns with but doesn't expand beyond the schema. With high schema coverage, the baseline score of 3 is appropriate, as the description doesn't provide additional parameter insights.

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: 'Lists access keys older than 90 days (or specified days).' It specifies the verb ('Lists'), resource ('access keys'), and scope ('older than 90 days or specified days'), making it easy to understand what the tool does. However, it doesn't explicitly differentiate from sibling tools like 'list_iam_users' or other list tools, which would require a 5.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention any prerequisites, context for usage, or comparisons with sibling tools (e.g., how it differs from general IAM listing tools). This leaves the agent without clear direction on appropriate use cases.

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/bhaveshopss/MCP-server'

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