feat: add getToolContext method to PluginMCPEntry interface - #1
Merged
Conversation
4 tasks
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.
Summary
Adds an optional
getToolContexthook toPluginMCPEntry, so a plugin can attach additional text to the response of any core Paca MCP tool call — not just tools the plugin owns.The motivating case: an AI agent calls
get_taskand gets back the task's title, status, activities, etc., but has no idea a GitHub branch or PR is linked to that task unless it separately discovers and callsgithub_list_task_branches.getToolContextlets the GitHub (or BDD, Checklist, …) plugin attach that info directly to theget_taskresponse instead.What's added
PluginMCPEntry.getToolContext?(toolId, args, context)— called once per loaded plugin after a successful core tool call. Returnsstring | null | undefined;null/undefinedmeans "nothing to add for this call" so the host omits the section instead of rendering empty boilerplate on every call.InstalledPlugin.manifest.mcp.toolContextHooks?: string[]— the plugin declares up front, inplugin.json, which core tool IDs it can contribute to (e.g."toolContextHooks": ["get_task"]). The host only invokesgetToolContextfor plugins that declared the tool being called — implementing the method without declaring it here means it's never called. This keeps the common case (a plugin only cares about one or two tools) a cheap map lookup on the host side instead of a fan-out call to every loaded plugin on every tool call.Usage
See the updated README for the full contract and error-handling semantics — plus the
get_task_by_numbercaveat (itsargshas notaskId, onlytaskNumber, so a hook scoped toget_taskwon't fire for it). A matching write-up fordocs/plugins/mcp-plugin-system.mdin the mainpacarepo is pending in a separate PR there.Also in this PR
node-versionfrom 20 → 24 in.github/workflows/cd.yml(unrelated, small).Consumers
com.paca.github,com.paca.bdd, andcom.paca.checklistall implementgetToolContextforget_task(branches/PRs, scenarios, and checklists respectively) — those changes ship in their own repos and depend on this SDK version.Test plan
tsc -p tsconfig.build.json && vite build— builds cleanapps/mcp): a real agent conversation'sget_taskcall returned a merged GitHub section for a task with a linked branch