Skip to main content
Glama

list_credentials

Retrieve credential IDs from n8n for use in workflow nodes to manage authentication and access.

Instructions

List all credentials in n8n with their IDs - use these IDs in workflow nodes

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler case in ToolHandler.handleTool that processes 'list_credentials' tool calls by delegating to N8nManager.listCredentials() and formatting the response as MCP content.
    case 'list_credentials':
      const credentials = await this.n8nManager.listCredentials();
      return {
        content: [{
          type: 'text',
          text: credentials.length > 0
            ? `šŸ“‹ Found ${credentials.length} credentials in n8n:\n\n` +
              credentials.map((c: any) => `• ID: ${c.id}\n  Name: ${c.name}\n  Type: ${c.type}`).join('\n\n') +
              '\n\nšŸ’” Use these IDs in your workflow nodes to reference credentials'
            : 'šŸ“­ No credentials found in n8n\n\n' +
              'šŸ’” Add credentials in the n8n UI first, then use this command to get their IDs'
        }]
      };
  • Core implementation in N8nManager that executes n8n CLI commands to list credentials, parses table/JSON output, falls back to API, and handles errors.
    async listCredentials(): Promise<any> {
      try {
        // Try different credential listing approaches
        // First try the credentials list command
        let command = 'n8n credential:list';
        console.error(`Executing: ${command}`);
    
        let stdout: string;
        let stderr: string;
    
        try {
          ({ stdout, stderr } = await execAsync(command, {
            timeout: 10000,
          }));
        } catch (error: any) {
          // If that fails, try alternative command
          console.error('credential:list failed, trying list:credential');
          command = 'n8n list:credential';
          try {
            ({ stdout, stderr } = await execAsync(command, {
              timeout: 10000,
            }));
          } catch (error2: any) {
            // If both fail, provide helpful message
            throw new Error(
              'Unable to list credentials via n8n CLI. ' +
              'Please check credentials manually in n8n UI at http://localhost:5678/credentials'
            );
          }
        }
    
        if (this.hasRealError(stderr, stdout)) {
          throw new Error(stderr);
        }
    
        // Parse the output - n8n outputs credentials as a table or JSON
        const lines = stdout.split('\n').filter(line => line.trim());
        const credentials: Array<{id: string, name: string, type: string}> = [];
    
        // Try to parse as JSON first
        try {
          const parsed = JSON.parse(stdout);
          if (Array.isArray(parsed)) {
            return parsed;
          }
        } catch {
          // Not JSON, parse as table
          // Skip header lines, typically starts with "ID" or similar
          let inData = false;
          for (const line of lines) {
            if (line.includes('ID') && line.includes('Name')) {
              inData = true;
              continue;
            }
            if (inData && line.trim()) {
              // Parse table row - format is typically: ID | Name | Type | ...
              const parts = line.split(/\s{2,}|\t|\|/).map(s => s.trim()).filter(s => s);
              if (parts.length >= 2) {
                credentials.push({
                  id: parts[0],
                  name: parts[1],
                  type: parts[2] || 'unknown'
                });
              }
            }
          }
        }
    
        return credentials;
      } catch (error: any) {
        // If CLI doesn't work, try using the API
        console.error('CLI approach failed, trying API approach');
    
        try {
          // Use curl to access n8n API (if available)
          const apiCommand = 'curl -s http://localhost:5678/rest/credentials';
          const { stdout: apiOutput } = await execAsync(apiCommand, {
            timeout: 5000,
          });
    
          const apiCredentials = JSON.parse(apiOutput);
          if (Array.isArray(apiCredentials.data)) {
            return apiCredentials.data.map((cred: any) => ({
              id: cred.id,
              name: cred.name,
              type: cred.type
            }));
          }
        } catch (apiError) {
          console.error('API approach also failed');
        }
    
        // If n8n is not running or command fails
        if (error.message.includes('command not found')) {
          throw new Error('n8n CLI is not installed');
        }
        if (error.message.includes('connect')) {
          throw new Error('n8n is not running. Start it with: n8n start');
        }
    
        // Return informative error
        throw new Error(
          'Unable to list credentials. The n8n CLI may not support this command. ' +
          'Please check your credentials manually in the n8n UI at http://localhost:5678/credentials\n\n' +
          'To find credential IDs:\n' +
          '1. Open n8n UI\n' +
          '2. Go to Credentials\n' +
          '3. Click on a credential\n' +
          '4. The ID is in the URL (e.g., /credentials/ABC123xyz/edit)'
        );
      }
    }
  • Tool registration in getToolDefinitions() array, including name, description, and input schema (empty object).
    {
      name: 'list_credentials',
      description: 'List all credentials in n8n with their IDs - use these IDs in workflow nodes',
      inputSchema: {
        type: 'object',
        properties: {},
      },
    },
  • Input schema definition for the tool (no required properties).
    inputSchema: {
      type: 'object',
      properties: {},
    },
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 mentions that the output includes credential IDs and hints at their use in workflow nodes, but doesn't describe the return format (e.g., list structure, pagination), permissions required, rate limits, or whether it's a read-only operation. For a tool with zero annotation coverage, this leaves significant gaps in understanding its behavior.

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 that front-loads the core purpose ('List all credentials in n8n with their IDs') and adds practical guidance ('use these IDs in workflow nodes'). Every word earns its place with zero waste or redundancy.

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

Completeness3/5

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

Given the tool's simplicity (0 parameters, no output schema, no annotations), the description is adequate but has clear gaps. It explains what the tool does and hints at output usage, but lacks details on return format, permissions, or error handling. For a list operation, this is minimally viable but could be more complete.

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

Parameters4/5

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

The tool has 0 parameters, and schema description coverage is 100% (empty schema is fully described). The description doesn't need to compensate for any parameter gaps. It appropriately focuses on the tool's purpose and output usage without unnecessary parameter details.

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: 'List all credentials in n8n with their IDs'. It specifies the verb ('List'), resource ('credentials in n8n'), and key output ('their IDs'). However, it doesn't explicitly differentiate from sibling tools like 'credentials' or 'list', which might have overlapping functionality.

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

Usage Guidelines3/5

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

The description provides implied usage guidance: 'use these IDs in workflow nodes' suggests this tool is for retrieving credential IDs to reference in other operations. However, it doesn't explicitly state when to use this tool versus alternatives like 'credentials' or 'list', nor does it mention any prerequisites or exclusions.

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/mckinleymedia/mcflow-mcp'

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