Skip to content

feat(mcp): add a parameterized 'onboard' prompt - #4021

Open
Ankitsinghsisodya wants to merge 4 commits into
knative:mainfrom
Ankitsinghsisodya:feat-mcp-onboard-prompt
Open

feat(mcp): add a parameterized 'onboard' prompt#4021
Ankitsinghsisodya wants to merge 4 commits into
knative:mainfrom
Ankitsinghsisodya:feat-mcp-onboard-prompt

Conversation

@Ankitsinghsisodya

@Ankitsinghsisodya Ankitsinghsisodya commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Changes

  • 🎁 Add an onboard MCP 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.
  • 🎁 Its steps use existing tools and resources: version, func://languages, create, local run/invoke/run_stop, registry setup, deploy + describe, remote invoke, summary.
  • 🎁 All four arguments (language, template, registry, cluster) are optional; omitted ones render as an instruction to ask the user at the relevant step. template defaults to http, cluster to local. Unrecognized values are rejected.
  • 🎁 In read-only mode the deploy-dependent steps are omitted.
  • 🧹 Add prompt helpers in pkg/mcp/prompts.go mirroring 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

The MCP server now offers an `onboard` prompt, which walks an agent through end-to-end onboarding: prerequisites, language choice, scaffolding, local run and invoke, registry setup, deploy, remote invoke, and a summary. Its `language`, `template`, `registry`, and `cluster` arguments are optional; anything not supplied is gathered from the user as the relevant step is reached.

Docs


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.
Copilot AI lite review requested due to automatic review settings August 24, 2026 15:30
@knative-prow knative-prow Bot added the kind/enhancement Feature additions or improvements to existing label Aug 24, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@knative-prow knative-prow Bot added the size/XL 🤖 PR changes 500-999 lines, ignoring generated files. label Aug 24, 2026
@knative-prow

knative-prow Bot commented Aug 24, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: Ankitsinghsisodya
Once this PR has been reviewed and has the lgtm label, please assign dprotaso for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

The lint job failed fetching the golangci-lint JSON schema from
golangci-lint.run (network timeout), not on anything in this change.
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/enhancement Feature additions or improvements to existing size/XL 🤖 PR changes 500-999 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants