resolve_credential_alias
Convert credential aliases to their corresponding IDs for use in n8n workflow automation and credential management operations.
Instructions
Resolve a credential alias to its ID
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| alias | Yes | The credential alias/name to resolve |
Implementation Reference
- src/index.ts:577-587 (handler)MCP tool handler method that takes an alias, calls N8nClient.resolveCredentialAlias, and returns the resolved credential ID in the standard MCP response format.private async handleResolveCredentialAlias(args: { alias: string }) { const credentialId = await this.n8nClient.resolveCredentialAlias(args.alias); return { content: [ { type: 'text', text: JSON.stringify(jsonSuccess({ alias: args.alias, id: credentialId }), null, 2), }, ], }; }
- src/index.ts:168-181 (registration)Tool registration in the listTools response, including name, description, and input schema definition.{ name: 'resolve_credential_alias', description: 'Resolve a credential alias to its ID', inputSchema: { type: 'object', properties: { alias: { type: 'string', description: 'The credential alias/name to resolve', }, }, required: ['alias'], }, },
- src/index.ts:168-181 (schema)Input schema definition for the resolve_credential_alias tool, specifying the 'alias' parameter.{ name: 'resolve_credential_alias', description: 'Resolve a credential alias to its ID', inputSchema: { type: 'object', properties: { alias: { type: 'string', description: 'The credential alias/name to resolve', }, }, required: ['alias'], }, },
- src/n8n-client.ts:238-251 (helper)Core helper method in N8nClient that implements the resolution logic: lists all credentials, filters by name matching the alias, handles no-match or multiple-match errors, and returns the credential ID.async resolveCredentialAlias(alias: string): Promise<string> { const credentials = await this.listCredentials(); const matches = credentials.filter(cred => cred.name === alias); if (matches.length === 0) { throw new Error(`No credential found with alias: ${alias}`); } if (matches.length > 1) { throw new Error(`Multiple credentials found with alias: ${alias}. Found ${matches.length} matches.`); } return matches[0].id!.toString(); }