copilot-plugin: let Copilot run TypeAgent actions directly over MCP - #2973
Open
George Ng (GeorgeNgMsft) wants to merge 1 commit into
Open
copilot-plugin: let Copilot run TypeAgent actions directly over MCP#2973George Ng (GeorgeNgMsft) wants to merge 1 commit into
George Ng (GeorgeNgMsft) wants to merge 1 commit into
Conversation
The plugin's MCP mode could only send natural language to typeagent-processCommand, so every request paid for TypeAgent translation even when the caller already knew exactly which typed action to run. Add two tools to the agent MCP server: typeagent-discoverActions reports the agents, actions and TypeScript contracts the session currently has enabled, and typeagent-executeAction runs one of them through the dispatcher's @action command, skipping translation and reasoning. typeagent-processCommand is unchanged and remains the path for conversational requests and for learn:/dev:/record: directives. The discovery and command-building protocol both MCP servers need now lives in @typeagent/dispatcher-types/helpers/actionDispatch, and command-executor uses it too. That fixes two bugs there: active filtering now works per sub-schema instead of per top-level agent, and a naturalLanguage phrase containing an apostrophe is no longer mangled by the command tokenizer. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What this does
Copilot CLI's TypeAgent plugin could only talk to TypeAgent in one way: send natural language to
typeagent-processCommandand let TypeAgent figure out what to do. That costs an LLM translation call on every request — even when Copilot already knows exactly which action it wants to run.This adds a direct path. Two new tools on the plugin's
typeagentMCP server:typeagent-discoverActions— asks what this session can actually run: the enabled agents, their actions with descriptions, and the TypeScript parameter contract for a specific action.typeagent-executeAction— runs one action byschemaName/actionName/parameters. The dispatcher validates it against its schema and executes it. No translation, no reasoning.typeagent-processCommandis unchanged and remains the path for conversational requests, multi-step work, and anything with alearn:/dev:/record:prefix. The guidance the plugin injects now tells the model to prefer the direct path only when it already knows the action, and not to re-discover on every turn.Highlights
commandExecutoralready had its own discovery/execution tools. Rather than duplicating them, the narrow common piece (command building, active-schema filtering, action lookup) moved into@typeagent/dispatcher-types/helpers/actionDispatch, which both MCP servers already depend on.commandExecutornow uses it too.commandExecutoras a result. Its enabled-schema filter worked per top-level agent instead of per sub-schema, and anaturalLanguagephrase containing an apostrophe was mangled by the command tokenizer.activeflag is true when either an agent's actions or its commands are enabled, but@actiononly runs when the actions are. A newactionActivefield reports the real thing, so discovery can't advertise an action that would then be refused. Older agent servers that don't report it fall back to the old flag.Validation
pnpm run build dispatcher-types dispatcher copilot-plugin command-executor-mcp— succeeded@typeagent/copilot-plugin: 12 suites, 85 tests passingcommand-executor-mcp: 4 tests passingNew tests cover the MCP catalog exposing the tools from the real bundled server, discovery filtering by enabled schema, direct execution emitting the
@actionpath rather than translation, injection rejection, cancellation, structured-content forwarding, and unchanged behavior in dev/bypass/processCommand modes.