n8n MCP 服务器工具参考(n8n MCP server tools reference)#
此页面描述了实例级 MCP 服务器提供的所有工具。
🌐 This page describes all tools exposed by the instance-level MCP server.
工作流管理(Workflow management)#
search_workflows#
搜索具有可选筛选器的工作流。返回每个工作流的预览。
🌐 Search for workflows with optional filters. Returns a preview of each workflow.
参数(Parameters)#
| 名称 | 类型 | 必填 | 描述 |
|---|---|---|---|
query |
string |
否 | 按名称或描述筛选 |
projectId |
string |
否 | 按项目ID筛选 |
limit |
integer |
否 | 限制结果数量(最多200) |
输出(Output)#
| 字段 | 类型 | 描述 |
|---|---|---|
data |
array |
工作流预览列表 |
data[].id |
string |
工作流的唯一标识符 |
data[].name |
string | null |
工作流的名称 |
data[].description |
string | null |
工作流的描述 |
data[].active |
boolean | null |
工作流是否处于激活状态 |
data[].createdAt |
string | null |
工作流创建时的 ISO 时间戳 |
data[].updatedAt |
string | null |
工作流上次更新的 ISO 时间戳 |
data[].triggerCount |
number | null |
与工作流关联的触发器数量 |
data[].scopes |
string[] |
用户对该工作流的权限 |
data[].canExecute |
boolean |
用户是否有权限执行此工作流 |
data[].availableInMCP |
boolean |
工作流是否对 MCP 工具可见 |
count |
integer |
与过滤条件匹配的工作流总数 |
注意(Notes)#
- 列类型在创建后是不可变的(通过 MCP)。
- 最大结果限制为200。
- 包含每个工作流的用户权限范围,以便 MCP 客户能够更多地了解他们可以使用该工作流做什么。
- 重要:此工具能够列出用户可以访问的所有工作流,无论其
Available in MCP设置如何。
get_workflow_details#
获取有关特定工作流的详细信息,包括触发器详情。
🌐 Get detailed information about a specific workflow including trigger details.
参数(Parameters)#
| 名称 | 类型 | 必填 | 描述 |
|---|---|---|---|
workflowId |
string |
是 | 要检索的工作流 ID |
输出(Output)#
| 字段 | 类型 | 描述 |
|-------|------|-------------|
| workflow | object | 已清理的工作流数据,可安全供 MCP 使用 |
| workflow.id | string | 工作流 ID |
| workflow.name | string | null | 工作流名称 |
| workflow.active | boolean | 工作流是否激活 |
| workflow.isArchived | boolean | 工作流是否已归档 |
| workflow.versionId | string | 当前工作流版本 ID |
| workflow.activeVersionId | string | null | 活动工作流版本 ID(如果有) |
| workflow.triggerCount | number | 触发器数量 |
| workflow.createdAt | string | null | ISO 创建时间戳 |
| workflow.updatedAt | string | null | ISO 最后更新时间戳 |
| workflow.settings | object | null | 工作流设置 |
| workflow.connections | object | 工作流连接图 |
| workflow.nodes | array | 节点列表(凭证已去除) |
| workflow.activeVersion | object | null | 活动工作流图(节点 + 连接),如果可用 |
| workflow.tags | array | 带有 id 和 name 的标签 |
| workflow.meta | object | null | 工作流元数据 |
| workflow.parentFolderId | string | null | 上级文件夹ID |
| workflow.description | string | 工作流的描述 |
| workflow.scopes | string[] | 此工作流的用户权限 |
| workflow.canExecute | boolean | 用户是否有权限执行此工作流 |
| triggerInfo | string | 描述如何触发工作流程的人类可读说明 |
注意(Notes)#
- 敏感的凭证数据在返回之前会从节点中移除。
- 如果工作流已发布,则包括活动版本的详细信息。
execute_workflow#
通过将用户提示的数据映射到触发器输入来按 ID 执行工作流。返回执行 ID 和状态。这将执行“完整”工作流执行,不会模拟或跳过任何节点。
🌐 Execute a workflow by ID by mapping data from user prompt to trigger inputs. Returns execution ID and status. This will perform 'full' workflow execution, without mocking or skipping any nodes.
参数(Parameters)#
| 名称 | 类型 | 必填 | 默认值 | 描述 |
|---|---|---|---|---|
workflowId |
string |
是 | 要执行的工作流的 ID | |
executionMode |
"manual" | "production" |
否 | "production" |
"manual" 测试当前版本,"production" 执行已发布(活动)版本 |
inputs |
object |
否 | 提供给工作流的输入(判别联合,见下文) |
inputs 变体(按 type 区分):
| 类型 | 字段 | 描述 |
|---|---|---|
chat |
chatInput: string |
聊天型工作流的输入 |
form |
formData: Record<string, unknown> |
表单型工作流的输入数据 |
webhook |
webhookData: { method?, query?, body?, headers? } |
Webhook型工作流的输入数据 |
输出(Output)#
| 字段 | 类型 | 描述 |
|---|---|---|
executionId |
string | null |
执行 ID |
status |
string |
执行的状态。可能的值之一:"success"、"error"、"running"、"waiting"、"canceled"、"crashed"、"new"、"unknown" |
error |
string |
如果执行失败,错误信息 |
注意(Notes)#
- 仅支持具有特定触发节点类型的工作流:Webhook、聊天触发、表单触发、手动触发、计划触发。
- 当
executionMode为"production"时,工作流必须有一个已发布(激活)版本。 - 如果一个工作流中有多个支持的触发器,MCP 客户端在使用工作流执行工具时可能只能使用其中一个(第一个)来触发工作流(不适用于 AI 工作流构建器的工作流)。
- 不支持执行包含多步骤表单或任何类型的人工交互的工作流。
get_execution#
Available from n8n v2.12.0
通过执行 ID 和工作流 ID 获取执行详细信息。默认情况下仅返回元数据。
🌐 Get execution details by execution ID and workflow ID. By default returns metadata only.
参数(Parameters)#
| 名称 | 类型 | 必填 | 描述 |
|---|---|---|---|
workflowId |
string |
是 | 此执行所属工作流的 ID |
executionId |
string |
是 | 要检索的执行 ID |
includeData |
boolean |
否 | 是否包含完整的执行结果数据。默认为 false(仅元数据)。 |
nodeNames |
string[] |
否 | 当 includeData 为 true 时,仅返回这些节点的数据。如果省略,则包含所有节点的数据。 |
truncateData |
integer |
否 | 当 includeData 为 true 时,限制每个节点输出返回的数据项数量。 |
输出(Output)#
| 字段 | 类型 | 描述 |
|---|---|---|
execution |
object | null |
执行元数据,如果发生错误则为 null |
execution.id |
string |
执行 ID |
execution.workflowId |
string |
工作流 ID |
execution.mode |
string |
执行模式 |
execution.status |
string |
执行状态 |
execution.startedAt |
string | null |
执行开始的 ISO 时间戳 |
execution.stoppedAt |
string | null |
执行停止的 ISO 时间戳 |
execution.retryOf |
string | null |
此次重试执行的原始执行 ID |
execution.retrySuccessId |
string | null |
成功重试执行的 ID |
execution.waitTill |
string | null |
执行等待到的 ISO 时间戳 |
data |
unknown |
执行结果数据(仅当 includeData 为 true 时存在) |
error |
string |
请求失败时的错误信息 |
注意(Notes)#
- 在不需要完整执行数据时,使用轻量级元数据查询(默认)。
- 通过
nodeNames进行过滤和通过truncateData进行截断有助于管理大型结果集。
test_workflow#
Available from n8n v2.15.0
使用固定数据测试工作流以绕过外部服务。触发节点、带凭据的节点和 HTTP 请求节点已固定(使用模拟数据)。其他节点(Set、If、Code 等)正常执行,包括无需凭据的 I/O 节点,如执行命令或文件读/写节点。
🌐 Test a workflow using pin data to bypass external services. Trigger nodes, nodes with credentials, and HTTP Request nodes are pinned (use simulated data). Other nodes (Set, If, Code, etc.) execute normally, including credential-free I/O nodes like Execute Command or file read/write nodes.
参数(Parameters)#
| 名称 | 类型 | 必填 | 描述 |
|---|---|---|---|
workflowId |
string |
是 | 要测试的工作流的ID |
pinData |
Record<string, array> |
是 | 所有工作流节点的固定数据 |
triggerNodeName |
string |
否 | 可选的触发节点名称,从该节点开始执行。默认是第一个触发节点。 |
输出(Output)#
| 字段 | 类型 | 描述 |
|---|---|---|
executionId |
string | null |
测试执行 ID |
status |
string |
测试执行的状态。可选值为:"success"、"error"、"running"、"waiting"、"canceled"、"crashed"、"new"、"unknown" |
error |
string |
执行失败时的错误信息 |
注意(Notes)#
- 可以用来测试工作流逻辑,无需设置凭据或访问外部服务。
- 此工具同步执行工作流(等待执行完成)。
- 有强制的 MCP 执行超时(5 分钟)。
prepare_test_pin_data#
Available from n8n v2.15.0
为工作流准备测试引脚数据。触发节点、带凭据的节点和 HTTP 请求节点需要引脚数据。逻辑节点(Set、If、Code 等)和无凭据的输入/输出节点(执行命令、文件读/写)在没有引脚数据的情况下也能正常执行。返回描述每个需要引脚数据的节点预期输出形状的 JSON 架构。
🌐 Prepare test pin data for a workflow. Trigger nodes, nodes with credentials, and HTTP Request nodes need pin data. Logic nodes (Set, If, Code, etc.) and credential-free I/O nodes (Execute Command, file read/write) execute normally without pin data. Returns JSON Schemas describing the expected output shape for each node that needs pin data.
参数(Parameters)#
| 名称 | 类型 | 必填 | 描述 |
|---|---|---|---|
workflowId |
string |
是 | 生成测试引脚数据的工作流 ID |
输出(Output)#
| 字段 | 类型 | 描述 |
|---|---|---|
nodeSchemasToGenerate |
Record<string, JsonSchema> |
需要引脚数据的节点。键是节点名称,值是描述预期输出形状的 JSON Schema 对象。 |
nodesWithoutSchema |
string[] |
需要引脚数据但没有输出模式的节点。对每个节点使用空默认值 [{"json": {}}] 。 |
nodesSkipped |
string[] |
不需要引脚数据的节点,在测试期间将正常执行。 |
coverage |
object |
覆盖统计 |
coverage.withSchemaFromExecution |
number |
模式从上一次成功执行输出中推断的节点 |
coverage.withSchemaFromDefinition |
number |
来自节点类型定义的模式节点 |
coverage.withoutSchema |
number |
没有数据或模式的节点 |
coverage.skipped |
number |
将正常执行的节点(不需要引脚数据) |
coverage.total |
number |
启用节点的总数 |
注意(Notes)#
- 应使用模式为
test_workflow生成真实的示例数据。
publish_workflow#
Available from n8n v2.12.0
发布(激活)工作流以使其可用于生产执行。这会从当前草稿创建一个活动版本。
🌐 Publish (activate) a workflow to make it available for production execution. This creates an active version from the current draft.
参数(Parameters)#
| 名称 | 类型 | 必填 | 描述 |
|---|---|---|---|
workflowId |
string |
是 | 要发布的工作流 ID |
versionId |
string |
否 | 可选发布的版本 ID。如果未提供,则发布当前草稿版本。 |
输出(Output)#
| 字段 | 类型 | 描述 |
|---|---|---|
success |
boolean |
是否发布成功 |
workflowId |
string |
工作流ID |
activeVersionId |
string | null |
发布后活动版本ID |
error |
string |
发布失败时的错误信息 |
unpublish_workflow#
Available from n8n v2.12.0
取消发布(停用)工作流以停止其在生产环境中执行。
🌐 Unpublish (deactivate) a workflow to stop it from being available for production execution.
参数(Parameters)#
| 名称 | 类型 | 是否必填 | 描述 |
|---|---|---|---|
workflowId |
string |
是 | 要取消发布的工作流的ID |
输出(Output)#
| 字段 | 类型 | 描述 |
|---|---|---|
success |
boolean |
取消发布是否成功 |
workflowId |
string |
工作流 ID |
error |
string |
如果取消发布失败的错误信息 |
search_projects#
Available from n8n v2.14.0
搜索当前用户可以访问的项目。
🌐 Search for projects accessible to the current user.
参数(Parameters)#
| 名称 | 类型 | 必填 | 描述 |
|---|---|---|---|
query |
string |
否 | 按名称过滤项目(大小写不敏感的部分匹配) |
type |
"personal" | "team" |
否 | 按项目类型过滤 |
limit |
integer |
否 | 限制结果数量(最大 100) |
输出(Output)#
| 字段 | 类型 | 描述 |
|---|---|---|
data |
array |
匹配项目列表 |
data[].id |
string |
项目的唯一标识符 |
data[].name |
string |
项目名称 |
data[].type |
"personal" | "team" |
项目类型 |
count |
integer |
匹配项目总数 |
注意(Notes)#
- 最大结果限制为100。
- 该工具使 MCP 客户能够在特定项目中创建工作流程和数据表。
search_folders#
Available from n8n v2.14.0
在项目中搜索文件夹。
🌐 Search for folders within a project.
参数(Parameters)#
| 名称 | 类型 | 必填 | 描述 |
|---|---|---|---|
projectId |
string |
是 | 要搜索文件夹的项目 ID |
query |
string |
否 | 按名称过滤文件夹(大小写不敏感的部分匹配) |
limit |
integer |
否 | 限制结果数量(最多 100 个) |
输出(Output)#
| 字段 | 类型 | 描述 |
|---|---|---|
data |
array |
匹配文件夹列表 |
data[].id |
string |
文件夹的唯一标识符 |
data[].name |
string |
文件夹名称 |
data[].parentFolderId |
string | null |
父文件夹ID,如果在项目根目录则为 null |
count |
integer |
匹配文件夹的总数 |
注意(Notes)#
- 最大结果限制为100。
- 此工具使 MCP 客户能够在指定文件夹中创建工作流。
工作流构建器(Workflow builder)#
get_sdk_reference#
Available from n8n v2.12.0
获取 n8n 工作流 SDK 参考文档,包括模式、表达式语法和函数。
🌐 Get the n8n Workflow SDK reference documentation including patterns, expression syntax, and functions.
参数(Parameters)#
| 名称 | 类型 | 是否必填 | 默认值 | 描述 |
|---|---|---|---|---|
section |
string |
否 | "all" |
要检索的文档部分。可选值之一:"patterns"、"expressions"、"functions"、"rules"、"import"、"guidelines"、"design"、"all" |
输出(Output)#
| 字段 | 类型 | 描述 |
|---|---|---|
reference |
string |
请求部分的 SDK 参考文档内容 |
注意(Notes)#
- 在构建任何工作流之前应该先调用。
- 各部分涵盖模式、表达式语法、内置函数、编码规则、导入语法、命名指南和设计指导。
search_nodes#
Available from n8n v2.12.0
按服务名称、触发类型或实用功能搜索 n8n 节点。返回节点 ID、区分符(资源/操作/模式)以及 get_node_types 工具所需的相关节点。
🌐 Search for n8n nodes by service name, trigger type, or utility function. Returns node IDs, discriminators (resource/operation/mode), and related nodes needed for get_node_types tool.
参数(Parameters)#
| 名称 | 类型 | 必填 | 描述 |
|---|---|---|---|
queries |
string[] |
是(最少 1 个) | 搜索查询 —— 服务名称(例如 "gmail"、"slack")、触发类型(例如 "schedule trigger"、"webhook")或实用节点(例如 "set"、"if"、"merge"、"code") |
输出(Output)#
| 字段 | 类型 | 描述 |
|---|---|---|
results |
string |
包含匹配节点 ID、判别器和相关节点的搜索结果 |
get_node_types#
Available from n8n v2.12.0
获取 n8n 节点的 TypeScript 类型定义。返回确切的参数名称和结构。
🌐 Get TypeScript type definitions for n8n nodes. Returns exact parameter names and structures.
参数(Parameters)#
| 名称 | 类型 | 必填 | 描述 |
|---|---|---|---|
nodeIds |
array |
是(最少 1 个) | 节点 ID 的数组。每个元素可以是普通字符串(例如 "n8n-nodes-base.gmail")或带有鉴别器的对象(见下文)。 |
节点 ID 对象格式:
| 字段 | 类型 | 必填 | 描述 |
|---|---|---|---|
nodeId |
string |
是 | 节点类型 ID(例如 "n8n-nodes-base.gmail") |
version |
string |
否 | 特定版本(例如 "2.1") |
resource |
string |
否 | 资源区分符(例如 "message") |
operation |
string |
否 | 操作区分符(例如 "send") |
mode |
string |
否 | 模式区分符 |
输出(Output)#
| 字段 | 类型 | 描述 |
|---|---|---|
definitions |
string |
请求节点的 TypeScript 类型定义 |
注意(Notes)#
- 对于正确的节点配置至关重要——MCP 客户端在编写工作流代码之前应始终调用。
- 支持简单字符串节点 ID 以及具有判别器的多变体节点对象。
get_suggested_nodes#
Available from n8n v2.12.0
获取针对工作流技术类别的精选节点推荐。返回带有模式提示和配置指导的推荐节点。在分析要构建的工作流类型后使用。
🌐 Get curated node recommendations for workflow technique categories. Returns recommended nodes with pattern hints and configuration guidance. Use after analyzing what kind of workflow to build.
参数(Parameters)#
| 名称 | 类型 | 必填 | 描述 |
|---|---|---|---|
categories |
string[] |
是(最少 1 个) | 工作流技术类别。可选值:chatbot、notification、scheduling、data_transformation、data_persistence、data_extraction、document_processing、form_input、content_generation、triage、find_research |
输出(Output)#
| 字段 | 类型 | 描述 |
|---|---|---|
suggestions |
string |
精选节点推荐,带有模式提示和配置指导 |
validate_workflow#
Available from n8n v2.12.0
验证 n8n 工作流 SDK 代码。将代码解析为工作流并检查错误。如果有效,则返回工作流 JSON,或返回详细的错误信息以供修复。始终在创建工作流前进行验证。
🌐 Validate n8n Workflow SDK code. Parses the code into a workflow and checks for errors. Returns the workflow JSON if valid, or detailed error messages to fix. Always validate before creating a workflow.
参数(Parameters)#
| 名称 | 类型 | 必填 | 描述 |
|---|---|---|---|
code |
string |
是 | 使用 n8n Workflow SDK 的完整 TypeScript/JavaScript 工作流代码。必须包含工作流导出。 |
输出(Output)#
| 字段 | 类型 | 描述 |
|---|---|---|
valid |
boolean |
工作流代码是否有效 |
nodeCount |
number |
工作流中的节点数量(如果有效) |
warnings |
array |
验证警告(如有) |
warnings[].code |
string |
标识警告类型的警告代码 |
warnings[].message |
string |
警告信息 |
warnings[].nodeName |
string |
触发警告的节点 |
warnings[].parameterPath |
string |
触发警告的参数路径 |
errors |
string[] |
验证错误(如果无效) |
注意(Notes)#
- 必须在
create_workflow_from_code或update_workflow之前调用。 - 即使代码有效,也可能存在警告。
create_workflow_from_code#
Available from n8n v2.12.0
从经过验证的 SDK 代码在 n8n 中创建工作流。将代码解析为工作流并保存。
🌐 Create a workflow in n8n from validated SDK code. Parses the code into a workflow and saves it.
参数(Parameters)#
| 名称 | 类型 | 必填 | 描述 |
|---|---|---|---|
code |
string |
是 | 使用 n8n Workflow SDK 的完整 TypeScript/JavaScript 工作流代码。必须先用 validate_workflow 进行验证。 |
name |
string |
否 | 可选的工作流名称(最多 128 个字符)。如果未提供,将使用代码中的名称。 |
description |
string |
否 | 简短的工作流描述(最多 255 个字符,1-2 句)。 |
projectId |
string |
否 | 要在其下创建工作流的项目 ID。默认为用户的个人项目。 |
folderId |
string |
否 | 要在其下创建工作流的文件夹 ID。需要设置 projectId。 |
输出(Output)#
| 字段 | 类型 | 描述 |
|---|---|---|
workflowId |
string |
创建的工作流的 ID |
name |
string |
创建的工作流的名称 |
nodeCount |
number |
工作流中的节点数量 |
url |
string |
在 n8n 中打开工作流的 URL |
autoAssignedCredentials |
array |
自动分配给节点的凭证列表 |
autoAssignedCredentials[].nodeName |
string |
自动分配凭证的节点名称 |
autoAssignedCredentials[].credentialName |
string |
自动分配的凭证名称 |
note |
string |
关于工作流创建的附加说明(例如在凭证自动分配期间跳过的节点) |
注意(Notes)#
- 自动将可用凭据分配给节点。
- 在凭证自动分配期间,HTTP 请求节点会被跳过,必须手动配置。
- 将创建的工作流的
availableInMCP标志设置为 true。 - 用
aiBuilderAssisted元数据标记工作流。 - 自动解析 webhook 节点 ID。
folderId也需要提供projectId。- MCP 客户应为所有新工作流程生成简短描述。
update_workflow#
Available from n8n v2.12.0
从已验证的 SDK 代码更新 n8n 中的现有工作流。将代码解析为工作流并保存更改。
🌐 Update an existing workflow in n8n from validated SDK code. Parses the code into a workflow and saves the changes.
参数(Parameters)#
| 名称 | 类型 | 必填 | 描述 |
|---|---|---|---|
workflowId |
string |
是 | 要更新的工作流 ID |
code |
string |
是 | 使用 n8n Workflow SDK 的完整 TypeScript/JavaScript 工作流代码。必须先用 validate_workflow 进行验证。 |
name |
string |
否 | 可选的工作流名称(最多 128 个字符)。如果未提供,则使用代码中的名称。 |
description |
string |
否 | 简短的工作流描述(最多 255 个字符,1-2 句)。 |
输出(Output)#
| 字段 | 类型 | 描述 |
|---|---|---|
workflowId |
string |
更新的工作流的ID |
name |
string |
更新的工作流的名称 |
nodeCount |
number |
工作流中的节点数量 |
url |
string |
在n8n中打开工作流的URL |
autoAssignedCredentials |
array |
自动分配给节点的凭证列表 |
autoAssignedCredentials[].nodeName |
string |
自动分配凭证的节点名称 |
autoAssignedCredentials[].credentialName |
string |
自动分配的凭证名称 |
note |
string |
工作流更新的附加说明(例如在凭证自动分配过程中跳过的节点) |
注意(Notes)#
- 通过按名称和类型匹配节点,保留现有工作流中用户配置的凭据。
- 用
aiBuilderAssisted元数据标记工作流。 - MCP 客户端应为所有已修改的工作流(重新)生成简短描述。
archive_workflow#
Available from n8n v2.12.0
通过其ID在n8n中归档工作流。
🌐 Archive a workflow in n8n by its ID.
参数(Parameters)#
| 名称 | 类型 | 必填 | 描述 |
|---|---|---|---|
workflowId |
string |
是 | 要归档的工作流的 ID |
输出(Output)#
| 字段 | 类型 | 描述 |
|---|---|---|
archived |
boolean |
工作流是否已归档 |
workflowId |
string |
已归档工作流的 ID |
name |
string |
已归档工作流的名称 |
注意(Notes)#
- 幂等 - 跳过已归档的工作流。
数据表(Data tables)#
search_data_tables#
Available from n8n v2.16.0
搜索当前用户可访问的数据表。在修改或添加数据之前,使用此方法查找数据表ID。
🌐 Search for data tables accessible to the current user. Use this to find a data table ID before modifying or adding data to it.
参数(Parameters)#
| 名称 | 类型 | 是否必需 | 描述 |
|---|---|---|---|
query |
string |
否 | 按名称过滤数据表(不区分大小写的部分匹配) |
projectId |
string |
否 | 按项目ID过滤 |
limit |
integer |
否 | 限制结果数量(最多100个) |
输出(Output)#
| 字段 | 类型 | 描述 |
|---|---|---|
data |
array |
与查询匹配的数据表列表 |
data[].id |
string |
数据表的唯一标识符 |
data[].name |
string |
数据表的名称 |
data[].projectId |
string |
数据表所属的项目 |
data[].createdAt |
string |
数据表创建时的 ISO 时间戳 |
data[].updatedAt |
string |
数据表最后更新时的 ISO 时间戳 |
data[].columns |
array |
此数据表定义的列 |
data[].columns[].id |
string |
列唯一标识符 |
data[].columns[].name |
string |
列名称 |
data[].columns[].type |
string |
列数据类型。可选值为:"string"、"number"、"boolean"、"date" |
data[].columns[].index |
integer |
列在表中的位置 |
count |
integer |
匹配的数据表总数 |
注意(Notes)#
- 最大结果限制为100。
create_data_table#
Available from n8n v2.16.0
创建一个包含指定列的新数据表。
🌐 Create a new data table with the specified columns.
参数(Parameters)#
| 名称 | 类型 | 必填 | 描述 |
|---|---|---|---|
projectId |
string |
是 | 数据表将要创建的项目 ID |
name |
string |
是 | 数据表的名称(最少 1 个字符,最多 128 个字符,在项目内必须唯一) |
columns |
array |
必填(至少 1 个) | 要在数据表中创建的列 |
columns[].name |
string |
是 | 列名,必须以字母开头,只能包含字母、数字和下划线(最多 63 个字符) |
columns[].type |
string |
是 | 列的数据类型,可选值:"string"、"number"、"boolean"、"date" |
输出(Output)#
| 字段 | 类型 | 描述 |
|---|---|---|
id |
string |
创建的数据表的唯一标识符 |
name |
string |
创建的数据表的名称 |
projectId |
string |
创建的数据表所属的项目 ID |
注意(Notes)#
- 至少需要一列。
- 表名在项目中必须唯一。
- 列名必须符合以下模式:
^[a-zA-Z][a-zA-Z0-9_]*$(最多63个字符)。
add_data_table_column#
Available from n8n v2.16.0
向现有数据表中添加新列。
🌐 Add a new column to an existing data table.
参数(Parameters)#
| 名称 | 类型 | 必填 | 描述 |
|---|---|---|---|
dataTableId |
string |
是 | 要添加列的数据表的ID |
projectId |
string |
是 | 数据表所属的项目ID |
name |
string |
是 | 列名称。必须以字母开头,仅包含字母、数字和下划线(最多63个字符)。 |
type |
string |
是 | 新列的数据类型。可选值之一:"string"、"number"、"boolean"、"date" |
输出(Output)#
| 字段 | 类型 | 描述 |
|---|---|---|
success |
boolean |
操作是否成功 |
message |
string |
结果描述 |
column |
object |
创建的列 |
column.id |
string |
列唯一标识符 |
column.name |
string |
列名称 |
column.type |
string |
列数据类型 |
注意(Notes)#
- 列名必须符合以下模式:
^[a-zA-Z][a-zA-Z0-9_]*$(最多63个字符)。 - 列类型在创建后是不可变的(通过 MCP)。
rename_data_table_column#
Available from n8n v2.16.0
重命名数据表中的列。
🌐 Rename a column in a data table.
参数(Parameters)#
| 名称 | 类型 | 必填 | 描述 |
|---|---|---|---|
dataTableId |
string |
是 | 包含该列的数据表的ID |
projectId |
string |
是 | 数据表所属的项目ID |
columnId |
string |
是 | 需要重命名的列ID |
name |
string |
是 | 新的列名。必须遵循列命名规则 |
输出(Output)#
| 字段 | 类型 | 描述 |
|---|---|---|
success |
boolean |
操作是否成功 |
message |
string |
结果描述 |
column |
object |
重命名的列 |
column.id |
string |
列唯一标识符 |
column.name |
string |
新列名 |
column.type |
string |
列数据类型 |
注意(Notes)#
- 新名称必须遵循列命名规则:
^[a-zA-Z][a-zA-Z0-9_]*$(最多63个字符)。
delete_data_table_column#
Available from n8n v2.16.0
从数据表中删除一列。这将永久删除该列及其所有数据。
🌐 Delete a column from a data table. This permanently removes the column and all its data.
参数(Parameters)#
| 名称 | 类型 | 是否必填 | 描述 |
|---|---|---|---|
dataTableId |
string |
是 | 包含该列的数据表的 ID |
projectId |
string |
是 | 数据表所属的项目 ID |
columnId |
string |
是 | 要删除的列的 ID |
输出(Output)#
| 字段 | 类型 | 描述 |
|---|---|---|
success |
boolean |
操作是否成功 |
message |
string |
结果描述 |
注意(Notes)#
- 通过MCP删除列无法撤销。
rename_data_table#
Available from n8n v2.16.0
重命名现有的数据表。
🌐 Rename an existing data table.
参数(Parameters)#
| 名称 | 类型 | 必填 | 描述 |
|---|---|---|---|
dataTableId |
string |
是 | 要重命名的数据表的 ID |
projectId |
string |
是 | 数据表所属的项目 ID |
name |
string |
是 | 数据表的新名称(最少 1 个字符,最多 128 个字符) |
输出(Output)#
| 字段 | 类型 | 描述 |
|---|---|---|
success |
boolean |
操作是否成功 |
message |
string |
结果描述 |
注意(Notes)#
- 名称在项目中必须唯一。
add_data_table_rows#
Available from n8n v2.16.0
将行插入到现有的数据表中。每一行都是一个将列名映射到值的对象。
🌐 Insert rows into an existing data table. Each row is an object mapping column names to values.
参数(Parameters)#
| 名称 | 类型 | 必填 | 描述 |
|---|---|---|---|
dataTableId |
string |
是 | 要插入行的数据表的ID |
projectId |
string |
是 | 数据表所属的项目ID |
rows |
array |
是(最少1,最多1000) | 行对象数组。每个对象将列名映射到值(string、number、boolean 或 null)。 |
输出(Output)#
| 字段 | 类型 | 描述 |
|---|---|---|
success |
boolean |
插入操作是否成功 |
insertedCount |
integer |
成功插入的行数 |
注意(Notes)#
- 每次调用最多 1000 行。
- 行值必须是
string、number、boolean或null。 - 行对象中的列名必须与数据表中现有的列名匹配。