feat(go): full endpoint editability via MCP, with validation - #238
Merged
Conversation
…endpoints create/update accept userVerification/agentForward (Node's schema stripped them); typed EndpointPatch replaces map[string]any; enum/bool/description-cap validation; create now defaults agentForward=true (Node repo parity)
… too — zod schema no longer strips them; both backends now match the full-editability contract
…tion/agentForward
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
Makes
shellwatch_manage_endpointscreate/update accept every REST-editable field —userVerification,agentForward,label,host,port,username,description— with proper validation, in both backends. Full endpoint editability via MCP is the intended contract; the tool schema silently strippinguserVerification/agentForwardwas a bug, not the spec.Go changes
internal/agent/session.go—UpdateEndpointnow takes a typedEndpointPatch(nil = keep,DescriptionSettri-state for null-clears) instead ofmap[string]any, keeping MCP wire shape out of the session-isolation type.internal/mcp/tools_endpoints.go— newendpointPatchFromWiredecode/validate layer (the zod equivalent):userVerificationenum,agentForwardboolean,description≤1000 chars or null, field type checks. Tooldatainput schema now declares the properties (incl. the enum) so agents can discover them.agentForward=false; it now defaultstruelike the Node repo and REST. ExplicituserVerification/agentForwardon create are honored (validated), defaults unchanged (required/true/port 22).Node changes
src/mcp/tools/endpoints.ts— the zoddataschema gainsuserVerification(enum) andagentForward(boolean); create passes them through (repo defaultsrequired/truestill apply when absent). Update needed no repo changes — the repository already accepted the fields; only the tool schema stripped them.Docs
docs/api/mcp-tools.mddocuments the fulldatashape, create defaults, and validation-rejects behavior.docs/api/README.mditem C notes the former stripping as a resolved bug in both backends.Tests
internal/mcp/tools_endpoints_test.go— decode/validation unit tests (valid full patch, null-clear, enum/type/length rejections).internal/agent/session_endpoint_test.go— typed patch merge incl.userVerification+ description set/clear.internal/httpserver/mcp_test.go::TestMCPEndpointFullEdit— Go end-to-end over the real streamable-HTTP transport: create with non-default fields, update them, invalid enum rejected without mutating the row, create defaults verified.src/mcp/server.test.ts— Node end-to-end: create/update with the new fields, read-back, invalid enum rejected without writing.go vet ./...,go test ./...,pnpm typecheck,pnpm lint(changed files),pnpm vitest run src/mcp/server.test.ts,pnpm spdx:checkall pass; mcp-* goldens untouched (create/update were never golden-pinned).