refactor(mcp): call pkg/functions directly for config list tools#3792
refactor(mcp): call pkg/functions directly for config list tools#3792xenonnn4w wants to merge 1 commit into
Conversation
Migrate the config_envs_list, config_labels_list and config_volumes_list MCP tools from shelling out to `func config ...` to reading the function directly via pkg/functions.NewFunction. Results are returned as typed structured data in StructuredContent. The CLI-only `verbose` input is dropped.
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: xenonnn4w 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 |
|
Hi @xenonnn4w. Thanks for your PR. I'm waiting for a knative member to verify that this patch is reasonable to test. If it is, they should reply with Tip We noticed you've done this a few times! Consider joining the org to skip this step and gain Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3792 +/- ##
===========================================
- Coverage 56.83% 45.45% -11.39%
===========================================
Files 185 200 +15
Lines 21739 23478 +1739
===========================================
- Hits 12355 10671 -1684
- Misses 8132 11859 +3727
+ Partials 1252 948 -304
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Describe
Migrates the MCP config list tools,
config_envs_list,config_labels_list, andconfig_volumes_list, from shelling out tofunc config ...(and parsing stdout) to loading the function directly viapkg/functions.NewFunction.This is the next slice of the broader
pkg/mcp->pkg/functionsmigration tracked inpkg/functionsdirectly, not shell out to thefuncbinary #3771,following the list tool migration in
Changes
Updates each list handler to call
fn.NewFunction(path)and read configured envs/labels/volumes directly from thefn.Functionstruct.ConfigEnvsListOutput,ConfigLabelsListOutput, andConfigVolumesListOutputnow carry typed structured data intoCallToolResult.StructuredContent.Keeps
Messageas a short human-readable fallback summary.Adds MCP-local DTOs:
EnvVarLabelPairVolumeMountVolumePVCVolumeEmptyDirThese mirror the corresponding
fntypes and are required because the MCP SDK output-schema generator cannot parse theinvopop/jsonschemastruct tags present onfn.Env,fn.Label, andfn.Volume.Removes the
Verboseinput from all three tools since it only controlled subprocess logging and no longer applies once the calls are in-process.Tests
writeTestFunctionhelper for constructing test functions.fn.NewFunctionrather than subprocess execution.Other MCP tools (
config add/remove,build,deploy, etc.) continue using theexecutorinterface for now and will migrate incrementally as part of the phased plan inpkg/functionsdirectly, not shell out to thefuncbinary #3771.Related Issues
Relates to MCP server should call
pkg/functionsdirectly, not shell out to thefuncbinary #3771Relates to MCP: consume
func --jsonoutput and forward structured errors via CallToolResult.StructuredContent #3770Based on refactor(mcp): call pkg/functions directly for list tool #3778
Additional reviewer notes
No
cmd/mcp.gochange:config list tools read
func.yamldirectly from disk via package-levelfn.NewFunction, so no*fn.ClientorWithClientProviderplumbing is required.refactor(mcp): call pkg/functions directly for list tool #3778 is referenced only for migration context:
this branch is based directly on
upstream/mainand merges independently.VI. Checklist