n8n_get_credential_schema
Retrieve the required and optional fields for a specific credential type in n8n, enabling proper credential setup before automation workflows.
Instructions
Get the schema/fields required for a credential type.
Args:
credentialType (string): The credential type (e.g., "slackApi", "httpBasicAuth")
Returns: JSON schema showing required and optional fields for the credential type.
Use this before creating credentials to know what data fields are needed.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| credentialType | Yes | The credential type to get schema for (e.g., "slackApi") |
Implementation Reference
- src/tools/credentials.ts:237-252 (handler)The handler function for n8n_get_credential_schema which fetches and formats the credential schema.
async (params: z.infer<typeof CredentialSchemaRequestSchema>) => { const schema = await get<N8nCredentialSchema>(`/credentials/schema/${params.credentialType}`); const properties = Object.entries(schema.properties || {}).map(([key, value]) => { const required = schema.required?.includes(key) ? '(required)' : '(optional)'; return ` - ${key} ${required}: ${value.type}${value.description ? ` - ${value.description}` : ''}`; }).join('\n'); const text = `**Credential Schema: ${params.credentialType}**\n\nFields:\n${properties}`; return { content: [{ type: 'text', text }], structuredContent: schema }; } ); - src/tools/credentials.ts:215-236 (registration)Registration of the n8n_get_credential_schema tool.
// ============ Get Credential Schema ============ server.registerTool( 'n8n_get_credential_schema', { title: 'Get Credential Schema', description: `Get the schema/fields required for a credential type. Args: - credentialType (string): The credential type (e.g., "slackApi", "httpBasicAuth") Returns: JSON schema showing required and optional fields for the credential type. Use this before creating credentials to know what data fields are needed.`, inputSchema: CredentialSchemaRequestSchema, annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false } },