Skip to main content
Glama

list_expiring_certificates

Identify AWS ACM certificates approaching expiration within a specified timeframe to facilitate timely renewal and prevent service disruptions.

Instructions

Lists ACM certificates expiring within the specified days.

Input Schema

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

Implementation Reference

  • Handler function that executes the tool logic: lists ACM certificates using ListCertificatesCommand, describes each to check expiration date with DescribeCertificateCommand, filters those expiring within 'days' threshold (default 30), and returns a JSON list.
    if (name === "list_expiring_certificates") {
        const days = (args as any)?.days || 30;
        const thresholdDate = new Date(Date.now() + days * 24 * 60 * 60 * 1000);
    
        const listCmd = new ListCertificatesCommand({});
        const listResp = await acmClient.send(listCmd); // Note: paginates 1000 by default
    
        const expiringCerts = [];
    
        // We need to describe to get 'NotAfter'
        for (const certSummary of listResp.CertificateSummaryList || []) {
            if (!certSummary.CertificateArn) continue;
            try {
                const descCmd = new DescribeCertificateCommand({ CertificateArn: certSummary.CertificateArn });
                const descResp = await acmClient.send(descCmd);
                const cert = descResp.Certificate;
    
                if (cert && cert.NotAfter && cert.NotAfter < thresholdDate) {
                    expiringCerts.push({
                        DomainName: cert.DomainName,
                        CertificateArn: cert.CertificateArn,
                        NotAfter: cert.NotAfter,
                        Status: cert.Status,
                        InUseBy: cert.InUseBy
                    });
                }
            } catch (err) {
                // Ignore
            }
        }
    
        return {
            content: [{ type: "text", text: JSON.stringify(expiringCerts, null, 2) }]
        };
    }
  • src/index.ts:372-383 (registration)
    Tool registration in the ListToolsRequestSchema handler, including name, description, and input schema.
        name: "list_expiring_certificates",
        description: "Lists ACM certificates expiring within the specified days.",
        inputSchema: {
            type: "object",
            properties: {
                days: {
                    type: "number",
                    description: "Number of days threshold (default: 30)."
                }
            }
        }
    },
  • Input schema for the tool parameters.
    inputSchema: {
        type: "object",
        properties: {
            days: {
                type: "number",
                description: "Number of days threshold (default: 30)."
            }
        }
    }
  • ACMClient initialization used by the handler.
    const acmClient = new ACMClient({});
  • Import of ACMClient, ListCertificatesCommand, and DescribeCertificateCommand.
    import { ACMClient, ListCertificatesCommand, DescribeCertificateCommand } from "@aws-sdk/client-acm";

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