Skip to content

fix(mcp): support dynamic array and map args - #6080

Open
ousamabenyounes wants to merge 3 commits into
scaleway:mainfrom
ousamabenyounes:fix/issue-5582
Open

fix(mcp): support dynamic array and map args#6080
ousamabenyounes wants to merge 3 commits into
scaleway:mainfrom
ousamabenyounes:fix/issue-5582

Conversation

@ousamabenyounes

Copy link
Copy Markdown

Community Note

  • Please vote on this pull request by adding a 👍 reaction to the original pull request comment to help the community and maintainers prioritize this request.
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for pull request followers and do not help prioritize the request

Closes #5582

Release note for CHANGELOG:

fix MCP dynamic array and map argument schemas and execution

Summary

  • expose single dynamic array arguments such as tags.{index} as MCP array properties such as tags
  • expose single dynamic map arguments such as environment-variables.{key} as MCP object properties with string values
  • expand structured MCP array/object input back into CLI raw args before unmarshalling

Test verification (RED → GREEN)

RED before implementation, with tests only:

--- FAIL: TestCommandToolExecuteWithDynamicArrayAndMapArgs
cannot unmarshal arg 'tags=["frontend","production"]': missing index on the array
--- FAIL: TestCommandToFlatArgsSchemaDynamicArgs
Schema should not expose literal placeholder property "tags.{index}"

GREEN after implementation:

ok github.com/scaleway/scaleway-cli/v2/internal/namespaces/mcp/server

Revert check after implementation, with production files stashed and tests kept, went RED again:

--- FAIL: TestCommandToolExecuteWithDynamicArrayAndMapArgs
cannot unmarshal arg 'tags=["frontend","production"]': missing index on the array
--- FAIL: TestCommandToFlatArgsSchemaDynamicArgs
Schema should not expose literal placeholder property "tags.{index}"

Full local validation suite:

./run-ci.sh
diff-coverage-gate: PASS 100.00% (126/126) changed production lines covered
golangci-lint: 0 issues
go run cmd/scw/main.go -h: pass
go test -v ./... -timeout 20m: only known baseline Docker-only container deploy failure observed

The full-suite baseline failure was already present before this change in internal/namespaces/container/v1 Test_Deploy/Buildpack because the Docker test environment cannot create /.pack.

Expose single dynamic array and map placeholders as structured MCP schema properties, then expand structured MCP inputs into CLI raw args before unmarshalling.

Generated by Ora Studio

Vibe coded by ousamabenyounes

Co-Authored-By: Ora Agent <noreply@oratelecom.net>
@remyleone

Copy link
Copy Markdown
Member

Thanks a lot @ousamabenyounes for your contribution. Could you sign your commits?

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 50.84%. Comparing base (eb65e6b) to head (f8f52fb).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6080      +/-   ##
==========================================
+ Coverage   50.78%   50.84%   +0.05%     
==========================================
  Files         359      359              
  Lines       82294    82357      +63     
==========================================
+ Hits        41797    41875      +78     
+ Misses      40497    40482      -15     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@ousamabenyounes

Copy link
Copy Markdown
Author

Thanks for the heads-up, Rémy! It's done — I signed my commit and it now shows as Verified on GitHub. I also kept your tests and the merge from main in the branch. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Arrays are not handled well with the MCP server

3 participants