Skip to main content
Glama

create-credential

Create credentials for n8n workflow nodes to authenticate with external services like Cloudflare, GitHub, and Slack. Use get-credential-schema first to identify required fields.

Instructions

Create a credential that can be used by nodes of the specified type. The credential type name can be found in the n8n UI when creating credentials (e.g., 'cloudflareApi', 'githubApi', 'slackOAuth2Api'). Use get-credential-schema first to see what fields are required for the credential type you want to create.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
clientIdYes
nameYes
typeYes
dataYes

Implementation Reference

  • MCP tool handler for 'create-credential' that validates client existence, calls N8nClient.createCredential, and returns success or error response.
    case "create-credential": {
      const { clientId, name, type, data } = args as {
        clientId: string;
        name: string;
        type: string;
        data: Record<string, any>;
      };
      const client = clients.get(clientId);
      if (!client) {
        return {
          content: [{
            type: "text",
            text: "Client not initialized. Please run init-n8n first.",
          }],
          isError: true
        };
      }
    
      try {
        const credential = await client.createCredential(name, type, data);
        return {
          content: [{
            type: "text",
            text: `Successfully created credential:\n${JSON.stringify(credential, null, 2)}`,
          }]
        };
      } catch (error) {
        return {
          content: [{
            type: "text",
            text: error instanceof Error ? error.message : "Unknown error occurred",
          }],
          isError: true
        };
      }
  • N8nClient method that performs the actual POST request to n8n API /credentials endpoint to create a new credential.
    async createCredential(name: string, type: string, data: Record<string, any>): Promise<any> {
      return this.makeRequest('/credentials', {
        method: 'POST',
        body: JSON.stringify({
          name,
          type,
          data
        }),
      });
    }
  • Input schema definition for the create-credential tool, specifying required parameters: clientId, name, type, data.
      inputSchema: {
        type: "object",
        properties: {
          clientId: { type: "string" },
          name: { type: "string" },
          type: { type: "string" },
          data: { type: "object" }
        },
        required: ["clientId", "name", "type", "data"]
      }
    },
  • src/index.ts:652-664 (registration)
    Tool registration in the listTools response, including name, description, and inputSchema for create-credential.
      name: "create-credential",
      description: "Create a credential that can be used by nodes of the specified type. The credential type name can be found in the n8n UI when creating credentials (e.g., 'cloudflareApi', 'githubApi', 'slackOAuth2Api'). Use get-credential-schema first to see what fields are required for the credential type you want to create.",
      inputSchema: {
        type: "object",
        properties: {
          clientId: { type: "string" },
          name: { type: "string" },
          type: { type: "string" },
          data: { type: "object" }
        },
        required: ["clientId", "name", "type", "data"]
      }
    },

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

B3.4/5.0
Behavior2/5

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

With no annotations provided, the description carries full burden. It mentions the creation action but doesn't disclose behavioral traits like authentication requirements, rate limits, whether credentials are stored securely, or what happens on failure. It only provides procedural guidance about using get-credential-schema first.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two sentences that are well-structured and front-loaded with the main purpose. The second sentence provides important procedural guidance. No wasted words, though it could be slightly more concise by integrating the examples more smoothly.

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?

For a 4-parameter creation tool with no annotations and no output schema, the description provides adequate purpose and usage guidance but lacks details about authentication requirements, error handling, and complete parameter documentation. It's minimally viable but has clear gaps in behavioral transparency and parameter semantics.

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

Parameters2/5

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

Schema description coverage is 0%, so the description must compensate. It only mentions the 'type' parameter with examples and implies 'data' contains credential fields, but doesn't explain 'clientId' or 'name' parameters. The description adds some meaning for 'type' and 'data' but leaves 'clientId' and 'name' completely undocumented.

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 creates a credential for nodes of a specified type, with specific examples of credential types. It distinguishes from siblings like delete-credential and get-credential-schema by focusing on creation. However, it doesn't explicitly contrast with other creation tools like create-project or create-workflow.

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 provides explicit guidance on when to use this tool: after using get-credential-schema to see required fields. It also specifies the context (credential type names from n8n UI) and implies not to use it without first checking schema requirements.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.