list_ssh_key_pairs
Use this tool to list SSH key pairs on the CloudStack MCP Server, enabling efficient management of cloud resources by filtering results based on key pair names or fingerprints.
Instructions
List SSH key pairs
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| fingerprint | No | Key fingerprint to filter | |
| name | No | Key pair name to filter |
Implementation Reference
- src/handlers/security-handlers.ts:6-29 (handler)Main handler function that executes the list_ssh_key_pairs tool by calling CloudStack API, processing key pairs data, and returning formatted MCP response.async handleListSSHKeyPairs(args: any) { const result = await this.cloudStackClient.listSSHKeyPairs(args); const keyPairs = result.listsshkeypairsresponse?.sshkeypair || []; const keyPairList = keyPairs.map((keyPair: any) => ({ name: keyPair.name, fingerprint: keyPair.fingerprint, account: keyPair.account, domain: keyPair.domain })); return { content: [ { type: 'text', text: `Found ${keyPairList.length} SSH key pairs:\n\n${keyPairList .map((keyPair: any) => `• ${keyPair.name}\n Fingerprint: ${keyPair.fingerprint}\n Account: ${keyPair.account}\n Domain: ${keyPair.domain}\n` ) .join('\n')}` } ] }; }
- Tool definition including name, description, and input schema for list_ssh_key_pairs.name: 'list_ssh_key_pairs', description: 'List SSH key pairs', inputSchema: { type: 'object', properties: { name: { type: 'string', description: 'Key pair name to filter', }, fingerprint: { type: 'string', description: 'Key fingerprint to filter', }, }, additionalProperties: false, }, },
- src/server.ts:200-201 (registration)Registration in the MCP server switch statement that routes calls to list_ssh_key_pairs to the security handler.case 'list_ssh_key_pairs': return await this.securityHandlers.handleListSSHKeyPairs(args);
- src/cloudstack-client.ts:273-275 (helper)Helper method in CloudStack client that makes the underlying API request for listing SSH key pairs.async listSSHKeyPairs(params: CloudStackParams = {}): Promise<CloudStackResponse> { return this.request('listSSHKeyPairs', params); }