feat: add create_data_element MCP tool#28
Closed
connor-savage wants to merge 1 commit intobot/mainfrom
Closed
Conversation
Generated by chip-factory pipeline.
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
EricWarnerCollibra
approved these changes
Feb 27, 2026
EricWarnerCollibra
left a comment
There was a problem hiding this comment.
Review: create_data_element tool
Convention Compliance ✅
All conventions are met:
- Package name
create_data_elementmatches directory name - Exports exactly
NewTool,Input,Output -
NewTooltakes*http.Client, returns*chip.Tool[Input, Output] -
handleris unexported, returnschip.ToolHandlerFunc[Input, Output] -
Input/Outputusejsonandjsonschematags - Optional fields use
json:"field,omitempty"(display_name,status_id) - Required fields (
name,domain_id) do NOT useomitempty - Tool name
create_data_elementis snake_case - Errors returned as
Output{}, err— no panics - No direct
mcp-goimports - Client calls go through
pkg/clients/create_data_element_client.go -
Permissionsincludes"dgc.ai-copilot" - Registered in
register.go
Build ✅
go build ./cmd/chip — passes
Unit Tests ✅
All 9 tests pass:
- Success, WithOptionalFields, MissingName, MissingDomainID, DuplicateNameConflict, Unauthorized, Forbidden, ServerError, SetsCorrectTypeID
Full Test Suite ✅
go test ./... — all packages pass
Lint ✅
golangci-lint run ./... — clean
MCP Validation ✅
factory mcp-list—create_data_elementis registeredfactory mcp-callhappy path — successfully created asset, returned{"id": "...", "resource_type": "Asset"}
Adversarial Testing ✅ (8 edge cases tested)
| Test | Result |
|---|---|
Empty name ("") |
✅ Tool returns "name is required" |
Empty domain_id ("") |
✅ Tool returns "domain_id is required" |
Missing name field entirely |
✅ MCP schema validation rejects with -32602 |
Malformed UUID ("not-a-uuid") |
✅ API returns HTTP 400, tool surfaces it |
| Duplicate name | ✅ API returns HTTP 400 "already exists", tool surfaces it |
Invalid status_id (zeros UUID) |
✅ API returns HTTP 404 "status not found", tool surfaces it |
| Unicode/emoji in name | ✅ Creates successfully, no crash |
| Very long name (1000 chars) | ✅ Creates successfully, no crash |
| HTML/XSS injection | ✅ Creates successfully (API's responsibility to sanitize), no crash |
| Permission denied domain | ✅ API returns HTTP 403, tool surfaces error clearly |
Client Code Review
pkg/clients/create_data_element_client.go:
- Correctly POSTs to
/rest/2.0/assets - Sets
Content-TypeandAcceptheaders - Properly handles non-2xx responses with status code and body
- Uses
json.NewDecoderfor response parsing - Uses
http.NewRequestWithContextfor context propagation
Summary
Clean, well-structured implementation that follows all conventions. Comprehensive test coverage (9 unit tests covering happy path, validation, HTTP errors, and type ID verification). All adversarial inputs handled gracefully — validation errors are caught early, and API errors are surfaced clearly. No issues found.
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.
Summary
Add
create_data_elementMCP tool to Chip.Generated by chip-factory pipeline.