Skip to content

feat(extensibility): migrate n8n hook execution to per-workflow MCP tool invocation - #324

Open
rishikunnath2747 wants to merge 6 commits into
SAP:mainfrom
rishikunnath2747:n8n_change
Open

feat(extensibility): migrate n8n hook execution to per-workflow MCP tool invocation#324
rishikunnath2747 wants to merge 6 commits into
SAP:mainfrom
rishikunnath2747:n8n_change

Conversation

@rishikunnath2747

Copy link
Copy Markdown
Contributor

Disclaimer: Do not include SAP-internal or customer-specific information in this PR (e.g. internal system URLs, customer names, tenant IDs, or confidential configurations). This is a public repository.

Description

Migrates n8n hook execution in the extensibility module from a workflow-ID-based polling model (using instance mcp) to a per-workflow MCP tool invocation model.

What changed:

  • N8nWorkflowConfig dataclass: workflow_id field removed; replaced with ord_id, card_ord_id, tool_name, and global_tenant_id
  • UMS GraphQL fragment updated to fetch the four new fields instead of workflowId
  • _build_hook() now skips hooks missing either toolName or cardOrdId (previously guarded on workflowId)
  • _discover_n8n_tools() now filters discovered MCP tools by both tool_name and card_ord_id (each hook is its own MCP server)
  • _execute_workflow_via_agw() rewritten: single call_mcp_tool() call; response is expected to be an A2A Message returned directly (no polling, no execution-tree traversal)
  • _poll_hook_execution() deleted — polling is no longer part of the AGW execution path
  • call_hook() (legacy direct-HTTP path) is unchanged
  • local_extensibility_example.json and user-guide.md updated to reflect the new schema

Type of Change

  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update
  • Code refactoring

How to Test

Checklist

  • I have read the Contributing Guidelines
  • I have verified that my changes solve the issue
  • I have added/updated automated tests to cover my changes
  • All tests pass locally
  • I have verified that my code follows the Code Guidelines
  • I have updated documentation (if applicable)
  • I have added type hints for all public APIs
  • My code does not contain sensitive information (credentials, tokens, etc.)
  • I have followed Conventional Commits for commit messages

Breaking Changes

What breaks:

  • UMS hook payloads that only contain workflowId (no toolName/cardOrdId) will be silently skipped rather than used.

Migration path:

  • Update existing hooks to include the four new fields: ordId, cardOrdId, toolName, globalTenantId.
  • The call_hook() legacy path is unaffected.

Alternative approaches considered:

  • Keeping workflow_id as an optional/deprecated field was ruled out to avoid maintaining a dead code path alongside the new model.

Additional Notes

The call_hook() method (direct HTTP path via HookConfig) is intentionally left unchanged. Only call_hook_agw() and the underlying AGW helper methods are modified by this PR.

This commit adds the changes to migrate the extensibility module to support the new n8n architecture
@rishikunnath2747
rishikunnath2747 requested a review from a team as a code owner September 9, 2026 21:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant