Skip to main content
Glama

create-credential

Generate credentials for specific node types in MCP-N8N, such as 'cloudflareApi' or 'slackOAuth2Api'. Define required fields using get-credential-schema to ensure compatibility.

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
dataYes
nameYes
typeYes

Implementation Reference

  • Executes the create-credential tool by retrieving the N8nClient instance using clientId and calling its createCredential method with provided name, type, and data. Handles client not found and API errors, returning formatted success or error messages.
    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
        };
      }
  • Core implementation in N8nClient class that sends a POST request to the n8n /credentials endpoint with the credential name, type, and data payload.
    async createCredential(name: string, type: string, data: Record<string, any>): Promise<any> {
      return this.makeRequest('/credentials', {
        method: 'POST',
        body: JSON.stringify({
          name,
          type,
          data
        }),
      });
    }
  • src/index.ts:652-664 (registration)
    Registers the 'create-credential' tool in the list of tools returned by the ListToolsRequestSchema handler, including its name, description, and input schema.
      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"]
      }
    },
  • JSON schema defining the input parameters for the create-credential tool: clientId, name, type, and data object.
    inputSchema: {
      type: "object",
      properties: {
        clientId: { type: "string" },
        name: { type: "string" },
        type: { type: "string" },
        data: { type: "object" }
      },
      required: ["clientId", "name", "type", "data"]
    }
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.

Install Server

Other Tools

Related 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/fellipesaraiva88/n8n-mcp-server'

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