feat(mcp): add a parameterized 'onboard' prompt - #4021
Open
Ankitsinghsisodya wants to merge 4 commits into
Open
Conversation
The server advertised prompts capability but registered none. Add the first: 'onboard', a multi-step workflow driving an agent end-to-end from an empty directory to a deployed, invocable Function. The eight steps map onto existing tools and resources: version (with a kubectl-context check), func://languages, create, run + invoke --target local + run_stop, registry elicitation, deploy + describe, invoke --target remote, and a summary read back out of tool output rather than out of what was requested. All four arguments (language, template, registry, cluster) are optional. Supplied values are rendered into the prompt and marked as decided; omitted ones render as an explicit instruction to ask the user at the relevant step, since neither a language nor a registry has a sane default. template defaults to http and cluster to local. Values are normalized (case, whitespace) and validated, with "cloudevent" resolving to the "cloudevents" template that actually exists on disk; the registry keeps its case, being an image reference prefix. Unrecognized values are rejected rather than rendered, so the agent is never sent off to run a command that cannot succeed. The prompt body is an embedded text/template, mirroring how the server's instructions are embedded. In read-only mode the registry, deploy and remote-invoke steps are omitted rather than handed to an agent that would be refused, and the user is told to restart with FUNC_ENABLE_MCP_WRITE=true.
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: Ankitsinghsisodya The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
The lint job failed fetching the golangci-lint JSON schema from golangci-lint.run (network timeout), not on anything in this change.
Ankitsinghsisodya
force-pushed
the
feat-mcp-onboard-prompt
branch
from
August 24, 2026 15:58
5f0984b to
208cf7f
Compare
The onboard prompt ran its local run and invoke before asking for a registry, on the theory that proving the Function works should not require one. It does: the default builder is pack, so a local run builds a container image, and naming that image needs a registry. Without one the build fails with "registry required" — for exactly the first-time user the prompt exists to serve, at a step the prompt forbids skipping past. Registry configuration is now step 4 and the local run step 5, which passes the gathered registry to run. Read-only mode omitted the registry step along with deploy and the remote invoke, yet still rendered "ask the user in step 5" in the parameters table, asked for a registry in the summary, and closed by telling the user to re-run deploy, which read-only refuses. The registry step is no longer omitted — a local build has to name an image whether or not it is ever pushed — and the remaining deploy-dependent text is now conditional. Language and template were validated against hardcoded lists. Which runtimes and templates exist depends on the installed binary and on any repositories added with the repository_add tool this same server exposes, so those lists rejected legitimate values outright. Only cluster is validated now, being prompt-internal and never passed to func; the rest are trimmed and passed through with their case intact, since a fold would corrupt the very repository-supplied names the lists used to reject. The agent is still told to check them against func://languages and func://templates. The deploy step named go and python as the host builder's runtimes. It now branches on oci.IsSupported, leaving pkg/oci the only place that list lives. Also: drop step 3's question about a Function name, there being no name argument to carry it (the name is the directory basename); drop the instruction to cd, which nothing depends on now that every tool call takes an absolute path; and assert table values in tests through a padding-insensitive match, so realigning the markdown cannot fail the build. Relates to knative#3737
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.
Changes
onboardMCP prompt that walks an agent from an empty directory to a deployed, invocable Function. The server advertised the prompts capability but registered none; this is the first.version,func://languages,create, localrun/invoke/run_stop, registry setup,deploy+describe, remoteinvoke, summary.language,template,registry,cluster) are optional; omitted ones render as an instruction to ask the user at the relevant step.templatedefaults tohttp,clustertolocal. Unrecognized values are rejected.pkg/mcp/prompts.gomirroring the existing resource helpers, and document the prompt in the server's agent instructions.The prompt body is an embedded
text/template(pkg/mcp/prompts_onboard.md), mirroring how the server's instructions are embedded./kind enhancement
Relates to #3737
Release Note
Docs