Skip to content

Commit ce24274

Browse files
akoclaude
andcommitted
fix: quote ProtocolVersion in DESCRIBE CONSUMED MCP SERVICE output (issue #435)
ProtocolVersion was emitted unquoted (e.g. ProtocolVersion: 2024-11-05), which the parser reads as integer arithmetic (2024 minus 11 minus 5) and rejects. The value is a version string, not a number, and must be quoted. Changed the format string from `%s` to `'%s'` (matching how Version and Documentation are already handled). The quoted form already round-trips correctly via the STRING_LITERAL alternative in modelProperty. Updated TestDescribeAgentEditorConsumedMCPService_Mock to assert the quoted form and added a parse roundtrip check. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent d930199 commit ce24274

2 files changed

Lines changed: 10 additions & 2 deletions

File tree

mdl/executor/cmd_agenteditor_mcpservices.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ func describeAgentEditorConsumedMCPService(ctx *ExecContext, name ast.QualifiedN
8383

8484
var lines []string
8585
if c.ProtocolVersion != "" {
86-
lines = append(lines, fmt.Sprintf(" ProtocolVersion: %s", c.ProtocolVersion))
86+
lines = append(lines, fmt.Sprintf(" ProtocolVersion: '%s'", escapeSQLString(c.ProtocolVersion)))
8787
}
8888
if c.Version != "" {
8989
lines = append(lines, fmt.Sprintf(" Version: '%s'", escapeSQLString(c.Version)))

mdl/executor/cmd_agenteditor_mock_test.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77

88
"github.com/mendixlabs/mxcli/mdl/ast"
99
"github.com/mendixlabs/mxcli/mdl/backend/mock"
10+
"github.com/mendixlabs/mxcli/mdl/visitor"
1011
"github.com/mendixlabs/mxcli/model"
1112
"github.com/mendixlabs/mxcli/sdk/agenteditor"
1213
)
@@ -524,7 +525,14 @@ func TestDescribeAgentEditorConsumedMCPService_Mock(t *testing.T) {
524525

525526
out := buf.String()
526527
assertContainsStr(t, out, "create consumed mcp service")
527-
assertContainsStr(t, out, "ProtocolVersion")
528+
// ProtocolVersion with a date value must be quoted so the output is re-parseable (issue #435)
529+
assertContainsStr(t, out, "ProtocolVersion: '2025-03-26'")
530+
531+
// Roundtrip: DESCRIBE output must parse without errors
532+
_, parseErrs := visitor.Build(out)
533+
if len(parseErrs) > 0 {
534+
t.Errorf("describe output is not valid MDL: %v\nOutput:\n%s", parseErrs[0], out)
535+
}
528536
}
529537

530538
// ---------------------------------------------------------------------------

0 commit comments

Comments
 (0)