feat(mcp): add workflow automation MCP tools for ingestion pipeline management#27741
Conversation
…anagement Addresses the Workflow Automation category from issue open-metadata#26609 (New MCP Tools). Adds three new MCP tools: - list_ingestion_pipelines: list pipelines by service/type with pagination - get_pipeline_status: fetch latest run status and recent run history - trigger_ingestion_pipeline: trigger an immediate pipeline run on demand Also adds McpApplicationContext to store OpenMetadataApplicationConfig at server init time, making it accessible from MCP tools without reflection.
|
Hi there 👋 Thanks for your contribution! The OpenMetadata team will review the PR shortly! Once it has been labeled as Let us know if you need any help! |
| case "create_metric": | ||
| result = new CreateMetricTool().execute(authorizer, limits, securityContext, params); | ||
| break; | ||
| case "list_ingestion_pipelines": |
There was a problem hiding this comment.
💡 Quality: Raw string literals used as tool name constants in switch
Per project standards ('No Magic: Never use raw strings for constants or logic branches. Use Enums/Constants.'), the new tool names "list_ingestion_pipelines", "get_pipeline_status", and "trigger_ingestion_pipeline" are used as bare string literals in the switch statement. These should be declared as named constants (matching the pattern that should be used for the existing cases as well, but that's out of scope).
Was this helpful? React with 👍 / 👎 | Reply gitar fix to apply this suggestion
| public Map<String, Object> execute( | ||
| Authorizer authorizer, CatalogSecurityContext securityContext, Map<String, Object> params) | ||
| throws IOException { | ||
| String fqn = (String) params.get("fqn"); | ||
| if (fqn == null || fqn.isBlank()) { | ||
| throw new IllegalArgumentException("Parameter 'fqn' is required"); | ||
| } | ||
|
|
||
| int limit = 5; | ||
| if (params.containsKey("limit")) { | ||
| Object limitObj = params.get("limit"); | ||
| if (limitObj instanceof Number number) { | ||
| limit = number.intValue(); | ||
| } else if (limitObj instanceof String s) { | ||
| try { |
There was a problem hiding this comment.
💡 Quality: Methods exceed 15-line guideline
The execute() methods in GetPipelineStatusTool (45 lines), ListIngestionPipelinesTool (56 lines), and TriggerIngestionPipelineTool (40 lines) exceed the 15-line method limit from the project coding standards. Consider extracting parameter parsing, authorization, and response building into separate private methods.
Was this helpful? React with 👍 / 👎 | Reply gitar fix to apply this suggestion
…guard, apply google-java-format - Extract duplicate limit-parsing logic to CommonUtils.parseLimit() - Add deployed check in TriggerIngestionPipelineTool before attempting runPipeline - Reformat all new files with google-java-format (GOOGLE style) to pass spotless check
|
Hi there 👋 Thanks for your contribution! The OpenMetadata team will review the PR shortly! Once it has been labeled as Let us know if you need any help! |
Code Review 👍 Approved with suggestions 3 resolved / 5 findingsImplements new MCP tools for ingestion pipeline management while resolving input parsing errors and missing deployment checks. Refactor the 💡 Quality: Raw string literals used as tool name constants in switch📄 openmetadata-mcp/src/main/java/org/openmetadata/mcp/tools/DefaultToolContext.java:86 📄 openmetadata-mcp/src/main/java/org/openmetadata/mcp/tools/DefaultToolContext.java:89 📄 openmetadata-mcp/src/main/java/org/openmetadata/mcp/tools/DefaultToolContext.java:92 Per project standards ('No Magic: Never use raw strings for constants or logic branches. Use Enums/Constants.'), the new tool names 💡 Quality: Methods exceed 15-line guideline📄 openmetadata-mcp/src/main/java/org/openmetadata/mcp/tools/GetPipelineStatusTool.java:22-36 📄 openmetadata-mcp/src/main/java/org/openmetadata/mcp/tools/ListIngestionPipelinesTool.java:34-48 📄 openmetadata-mcp/src/main/java/org/openmetadata/mcp/tools/TriggerIngestionPipelineTool.java:25-39 The ✅ 3 resolved✅ Edge Case: NumberFormatException silently swallowed, invalid input ignored
✅ Quality: Duplicate limit-parsing logic should be extracted to a helper
✅ Bug: TriggerIngestionPipelineTool doesn't check if pipeline is deployed
🤖 Prompt for agentsOptionsDisplay: compact → Showing less information. Comment with these commands to change:
Was this helpful? React with 👍 / 👎 | Gitar |
Summary
Closes part of #26609 — implements the Workflow Automation category of new MCP tools.
Adds three new tools to the OpenMetadata MCP server so agents can manage ingestion pipelines conversationally, without switching to the UI or calling REST APIs directly.
New Tools
list_ingestion_pipelinesget_pipeline_statustrigger_ingestion_pipelineArchitecture
sequenceDiagram participant Agent as AI Agent / MCP Client participant MCP as McpServer participant DTC as DefaultToolContext participant Repo as IngestionPipelineRepository participant PSC as PipelineServiceClient Agent->>MCP: call tool (e.g. trigger_ingestion_pipeline) MCP->>DTC: callTool(toolName, params) alt list_ingestion_pipelines DTC->>Repo: listAfter(filter, limit) Repo-->>DTC: ResultList<IngestionPipeline> else get_pipeline_status DTC->>Repo: getLatestPipelineStatus(pipeline) DTC->>Repo: listPipelineStatus(fqn, limit) Repo-->>DTC: PipelineStatus + history else trigger_ingestion_pipeline DTC->>Repo: getEntityByName(fqn) DTC->>PSC: runPipeline(pipeline, service) PSC-->>DTC: PipelineServiceClientResponse end DTC-->>MCP: Map<String, Object> MCP-->>Agent: CallToolResult (JSON)Files Changed
McpApplicationContext.java(new) — lightweight static holder forOpenMetadataApplicationConfig, populated at MCP server init so tools can access app config without reflectionMcpServer.java— registers config intoMcpApplicationContexton startupListIngestionPipelinesTool.java(new) — lists ingestion pipelines with service/type filtersGetPipelineStatusTool.java(new) — fetches latest status + recent run historyTriggerIngestionPipelineTool.java(new) — triggers a pipeline run viaPipelineServiceClientFactoryDefaultToolContext.java— wires the 3 new tools into the switch routertools.json— adds JSON schema definitions for all 3 tools (LLM-facing descriptions + input schemas)Example Agent Interactions
Checklist
McpToolinterface,Entity.getEntityRepository, auth viaauthorizer.authorize)VIEW_BASICfor list/status,EDIT_ALLfor trigger)tools.jsonschema updated with input validation and helpful descriptionsSummary by Gitar
CommonUtils.parseLimitto centralize limit parameter parsing and validation.ListIngestionPipelinesToolandGetPipelineStatusToolto utilize the new helper.TriggerIngestionPipelineToolto prevent triggering non-deployed pipelines.This will update automatically on new commits.