-
Notifications
You must be signed in to change notification settings - Fork 17
Add support for Model Context Protocol #120
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
examples/workflow-server/src/common/mcp/workflow-element-types-provider.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| /******************************************************************************** | ||
| * Copyright (c) 2026 EclipseSource and others. | ||
| * | ||
| * This program and the accompanying materials are made available under the | ||
| * terms of the Eclipse Public License v. 2.0 which is available at | ||
| * http://www.eclipse.org/legal/epl-2.0. | ||
| * | ||
| * This Source Code may also be made available under the following Secondary | ||
| * Licenses when the conditions for such availability set forth in the Eclipse | ||
| * Public License v. 2.0 are satisfied: GNU General Public License, version 2 | ||
| * with the GNU Classpath Exception which is available at | ||
| * https://www.gnu.org/software/classpath/license.html. | ||
| * | ||
| * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 | ||
| ********************************************************************************/ | ||
|
|
||
| import { DefaultTypes } from '@eclipse-glsp/server'; | ||
| import { ElementTypeEntry, ElementTypes, ElementTypesProvider } from '@eclipse-glsp/server-mcp'; | ||
| import { injectable } from 'inversify'; | ||
| import { ModelTypes } from '../util/model-types'; | ||
|
|
||
| const NODE_TYPES: ElementTypeEntry[] = [ | ||
| { id: ModelTypes.AUTOMATED_TASK, label: 'Automated Task', description: 'Task without human input', acceptsText: true }, | ||
| { id: ModelTypes.MANUAL_TASK, label: 'Manual Task', description: 'Task done by a human', acceptsText: true }, | ||
| { id: ModelTypes.JOIN_NODE, label: 'Join Node', description: 'Gateway that merges parallel flows', acceptsText: false }, | ||
| { id: ModelTypes.FORK_NODE, label: 'Fork Node', description: 'Gateway that splits into parallel flows', acceptsText: false }, | ||
| { id: ModelTypes.MERGE_NODE, label: 'Merge Node', description: 'Gateway that merges alternative flows', acceptsText: false }, | ||
| { id: ModelTypes.DECISION_NODE, label: 'Decision Node', description: 'Gateway that splits into alternative flows', acceptsText: false }, | ||
| { id: ModelTypes.CATEGORY, label: 'Category', description: 'Container node that groups other elements', acceptsText: true } | ||
| ]; | ||
|
|
||
| const EDGE_TYPES: ElementTypeEntry[] = [ | ||
| { id: DefaultTypes.EDGE, label: 'Edge', description: 'Standard control flow edge', acceptsText: false }, | ||
| { | ||
| id: ModelTypes.WEIGHTED_EDGE, | ||
| label: 'Weighted Edge', | ||
| description: 'Edge that indicates a weighted probability. Typically used with a Decision Node.', | ||
| acceptsText: false | ||
| } | ||
| ]; | ||
|
|
||
| /** | ||
| * Workflow-specific {@link ElementTypesProvider}. Returns the constant set of creatable types | ||
| * with richer LLM-facing fields (`description`, `acceptsText`) than the default registry-scrape | ||
| * impl can infer. Bound on the workflow MCP diagram module via `bindElementTypesProvider()`; | ||
| * the standard `element-types` tool handler exposes the full entries via `structuredContent` | ||
| * (with a short summary in the text content) — no handler rebind needed. | ||
| */ | ||
| @injectable() | ||
| export class WorkflowElementTypesProvider implements ElementTypesProvider { | ||
| get(): ElementTypes { | ||
| return { nodeTypes: NODE_TYPES, edgeTypes: EDGE_TYPES }; | ||
| } | ||
| } |
37 changes: 37 additions & 0 deletions
37
examples/workflow-server/src/common/mcp/workflow-mcp-label-provider.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| /******************************************************************************** | ||
| * Copyright (c) 2026 EclipseSource and others. | ||
| * | ||
| * This program and the accompanying materials are made available under the | ||
| * terms of the Eclipse Public License v. 2.0 which is available at | ||
| * http://www.eclipse.org/legal/epl-2.0. | ||
| * | ||
| * This Source Code may also be made available under the following Secondary | ||
| * Licenses when the conditions for such availability set forth in the Eclipse | ||
| * Public License v. 2.0 are satisfied: GNU General Public License, version 2 | ||
| * with the GNU Classpath Exception which is available at | ||
| * https://www.gnu.org/software/classpath/license.html. | ||
| * | ||
| * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 | ||
| ********************************************************************************/ | ||
|
|
||
| import { GLabel, GModelElement } from '@eclipse-glsp/server'; | ||
| import { DefaultMcpLabelProvider } from '@eclipse-glsp/server-mcp'; | ||
| import { injectable } from 'inversify'; | ||
| import { ModelTypes } from '../util/model-types'; | ||
|
|
||
| /** | ||
| * Workflow-specific {@link DefaultMcpLabelProvider}: category labels are nested inside a | ||
| * compartment-header child rather than directly under the category, so the default | ||
| * direct-child lookup misses them. Other workflow element types fall through to the | ||
| * inherited default. | ||
| */ | ||
| @injectable() | ||
| export class WorkflowMcpLabelProvider extends DefaultMcpLabelProvider { | ||
| override getLabel(element: GModelElement): GLabel | undefined { | ||
| if (element.type === ModelTypes.CATEGORY) { | ||
| const header = element.children.find(child => child.type === ModelTypes.COMP_HEADER); | ||
| return header?.children.find((child): child is GLabel => child instanceof GLabel); | ||
| } | ||
| return super.getLabel(element); | ||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Question: Should we update the example1.wf file on the client side to reflect this change?
Or is is purely cosmetically?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The file is already correct, just the server was inconsistent. We can leave it I believe.