list_certificates
Retrieve and filter certificates from an Octopus Deploy space to manage SSL/TLS credentials for secure deployments.
Instructions
List certificates in a space
This tool lists all certificates in a given space. The space name is required. You can optionally filter by various parameters like name, archived status, tenant, etc.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| spaceName | Yes | ||
| skip | No | ||
| take | No | ||
| search | No | ||
| archived | No | ||
| tenant | No | ||
| firstResult | No | ||
| orderBy | No | ||
| ids | No | ||
| partialName | No |
Implementation Reference
- src/tools/listCertificates.ts:30-79 (handler)The handler function that implements the core logic of the 'list_certificates' tool. It creates an Octopus Deploy client, resolves the space ID, fetches certificates with optional filters, maps them using mapCertificateResource, and returns structured JSON data.async ({ spaceName, skip, take, search, archived, tenant, firstResult, orderBy, ids, partialName, }) => { const configuration = getClientConfigurationFromEnvironment(); const client = await Client.create(configuration); const spaceId = await resolveSpaceId(client, spaceName); const response = await client.get<ResourceCollection<CertificateResource>>( "~/api/{spaceId}/certificates{?skip,take,search,archived,tenant,firstResult,orderBy,ids,partialName}", { spaceId, skip, take, search, archived, tenant, firstResult, orderBy, ids, partialName, } ); const certificates = response.Items.map((cert: CertificateResource) => mapCertificateResource(cert)); return { content: [ { type: "text", text: JSON.stringify({ totalResults: response.TotalResults, itemsPerPage: response.ItemsPerPage, numberOfPages: response.NumberOfPages, lastPageNumber: response.LastPageNumber, items: certificates, }), }, ], }; } );
- src/tools/listCertificates.ts:14-25 (schema)Zod input schema defining the parameters for the 'list_certificates' tool, including required spaceName and optional filters.{ spaceName: z.string(), skip: z.number().optional(), take: z.number().optional(), search: z.string().optional(), archived: z.boolean().optional(), tenant: z.string().optional(), firstResult: z.number().optional(), orderBy: z.string().optional(), ids: z.array(z.string()).optional(), partialName: z.string().optional(), },
- src/tools/listCertificates.ts:82-86 (registration)Registers the 'list_certificates' tool in the TOOL_REGISTRY with its configuration and registration function for conditional enabling.registerToolDefinition({ toolName: "list_certificates", config: { toolset: "certificates", readOnly: true }, registerFn: registerListCertificatesTool, });
- src/tools/listCertificates.ts:8-80 (registration)The function that registers the 'list_certificates' tool directly on the MCP server, specifying name, description, input schema, output hints, and handler.export function registerListCertificatesTool(server: McpServer) { server.tool( "list_certificates", `List certificates in a space This tool lists all certificates in a given space. The space name is required. You can optionally filter by various parameters like name, archived status, tenant, etc.`, { spaceName: z.string(), skip: z.number().optional(), take: z.number().optional(), search: z.string().optional(), archived: z.boolean().optional(), tenant: z.string().optional(), firstResult: z.number().optional(), orderBy: z.string().optional(), ids: z.array(z.string()).optional(), partialName: z.string().optional(), }, { title: "List all certificates in an Octopus Deploy space", readOnlyHint: true, }, async ({ spaceName, skip, take, search, archived, tenant, firstResult, orderBy, ids, partialName, }) => { const configuration = getClientConfigurationFromEnvironment(); const client = await Client.create(configuration); const spaceId = await resolveSpaceId(client, spaceName); const response = await client.get<ResourceCollection<CertificateResource>>( "~/api/{spaceId}/certificates{?skip,take,search,archived,tenant,firstResult,orderBy,ids,partialName}", { spaceId, skip, take, search, archived, tenant, firstResult, orderBy, ids, partialName, } ); const certificates = response.Items.map((cert: CertificateResource) => mapCertificateResource(cert)); return { content: [ { type: "text", text: JSON.stringify({ totalResults: response.TotalResults, itemsPerPage: response.ItemsPerPage, numberOfPages: response.NumberOfPages, lastPageNumber: response.LastPageNumber, items: certificates, }), }, ], }; } ); }
- src/types/certificateTypes.ts:49-80 (helper)Supporting utility function that maps the full Octopus Deploy CertificateResource to a simplified object returned by the tool.export function mapCertificateResource(cert: CertificateResource) { return { spaceId: cert.SpaceId, id: cert.Id, name: cert.Name, notes: cert.Notes, thumbprint: cert.Thumbprint, subjectDistinguishedName: cert.SubjectDistinguishedName, issuerDistinguishedName: cert.IssuerDistinguishedName, subjectCommonName: cert.SubjectCommonName, subjectOrganization: cert.SubjectOrganization, issuerCommonName: cert.IssuerCommonName, issuerOrganization: cert.IssuerOrganization, notAfter: cert.NotAfter, notBefore: cert.NotBefore, isExpired: cert.IsExpired, version: cert.Version, serialNumber: cert.SerialNumber, signatureAlgorithmName: cert.SignatureAlgorithmName, environmentIds: cert.EnvironmentIds, tenantIds: cert.TenantIds, tenantTags: cert.TenantTags, certificateDataFormat: cert.CertificateDataFormat, archived: cert.Archived, replacedBy: cert.ReplacedBy, selfSigned: cert.SelfSigned, selfSignedCertificateCurve: cert.SelfSignedCertificateCurve, hasPrivateKey: cert.HasPrivateKey, tenantedDeploymentParticipation: cert.TenantedDeploymentParticipation, subjectAlternativeNames: cert.SubjectAlternativeNames, }; }