Skip to main content
Glama

n8n_create_credential

Store API credentials for services like GitHub, Slack, or databases in n8n. Provide credential type, name, and authentication data to enable workflow connections.

Instructions

Store new API credentials for services like GitHub, Slack, or databases. Provide credential type, descriptive name, and authentication data. Use get_credential_schema first to see required fields for each type.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYesDescriptive name (e.g., "Production GitHub Token")
typeYesCredential type from get_credential_schema (e.g., githubApi, slackApi)
dataYesAuthentication data (API keys, OAuth tokens, passwords)

Implementation Reference

  • The createCredential method in N8nClient class is the actual handler that executes the tool logic. It makes a POST request to the n8n API endpoint /api/v1/credentials with the credential data as JSON body.
    async createCredential(credential: any) {
      return this.request(`${this.apiBase}/credentials`, {
        method: 'POST',
        body: JSON.stringify(credential),
      });
    }
  • Tool schema definition for n8n_create_credential. Defines the tool name, description, inputSchema with required properties (name, type, data), and annotations including title 'Create Credential'.
    {
      name: 'n8n_create_credential',
      description: 'Store new API credentials for services like GitHub, Slack, or databases. Provide credential type, descriptive name, and authentication data. Use get_credential_schema first to see required fields for each type.',
      inputSchema: {
        type: 'object',
        properties: {
          name: { type: 'string', description: 'Descriptive name (e.g., "Production GitHub Token")' },
          type: { type: 'string', description: 'Credential type from get_credential_schema (e.g., githubApi, slackApi)' },
          data: { type: 'object', description: 'Authentication data (API keys, OAuth tokens, passwords)' },
        },
        required: ['name', 'type', 'data'],
      },
      annotations: {
        title: 'Create Credential',
        readOnlyHint: false,
        destructiveHint: false,
        idempotentHint: false,
        openWorldHint: true,
      },
    },
  • src/server.ts:57-58 (registration)
    Registration of the tool handler in the handleToolCall function. Routes 'n8n_create_credential' tool calls to client.createCredential(args).
    case 'n8n_create_credential':
      return client.createCredential(args);
  • The private request method is a helper utility that handles authenticated API calls to n8n. It adds the X-N8N-API-KEY header, sets Content-Type, handles timeouts, and throws errors for non-OK responses.
    private async request<T>(
      endpoint: string,
      options: RequestInit = {}
    ): Promise<T> {
      const url = `${this.config.apiUrl}${endpoint}`;
    
      const response = await fetch(url, {
        ...options,
        signal: AbortSignal.timeout(this.timeout),
        headers: {
          'X-N8N-API-KEY': this.config.apiKey,
          'Content-Type': 'application/json',
          ...options.headers,
        },
      });
    
      if (!response.ok) {
        const error = await response.text();
        throw new Error(`n8n API Error (${response.status}): ${error}`);
      }
    
      return response.json() as Promise<T>;
    }
  • TypeScript interface N8nCredential defines the structure of credential objects with id, name, type, data, createdAt, and updatedAt fields.
    export interface N8nCredential {
      id: string;
      name: string;
      type: string;
      data?: any;
      createdAt: string;
      updatedAt: string;
    }
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already cover key behavioral traits (readOnlyHint=false, destructiveHint=false, etc.), so the bar is lower. The description adds useful context about credential types and the need to check schemas, but doesn't disclose additional behavioral details like authentication requirements, rate limits, or error handling. No contradiction with annotations.

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 efficiently structured in two sentences: the first states the purpose and parameters, the second provides crucial usage guidance. Every sentence earns its place with no wasted words, making it front-loaded and easy to parse.

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

Completeness4/5

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

For a creation tool with no output schema, the description is reasonably complete given good annotations and schema coverage. It covers purpose, parameters, and usage prerequisites, but lacks details on return values or error cases. Slightly incomplete without output information.

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

Parameters3/5

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

Schema description coverage is 100%, providing full parameter documentation. The description adds minimal semantic value beyond the schema by mentioning credential types and authentication data examples, but doesn't explain parameter interactions or constraints. Baseline 3 is appropriate given high schema coverage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the specific action ('Store new API credentials') and resource ('for services like GitHub, Slack, or databases'), distinguishing it from siblings like n8n_update_credential or n8n_delete_credential. It precisely identifies the tool's function as credential creation with examples.

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

Usage Guidelines5/5

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

The description explicitly provides when-to-use guidance by stating 'Use get_credential_schema first to see required fields for each type,' naming an alternative tool (n8n_get_credential_schema) for prerequisite information. This gives clear context for proper usage.

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/node2flow-th/n8n-management-mcp-community'

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