feat: add create_data_element MCP tool#26
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
left a comment
There was a problem hiding this comment.
Review: create_data_element MCP Tool
Summary
The create_data_element tool is well-implemented, follows all Chip conventions, and handles edge cases gracefully. Approved.
Convention Compliance ✅
- Package name matches directory (
create_data_element) - Exports exactly:
NewTool,Input,Output -
NewTooltakes*http.Client, returns*chip.Tool[Input, Output] -
handleris unexported, returnschip.ToolHandlerFunc[Input, Output] -
Input/Outputusejsonandjsonschematags - Optional fields (
display_name,status_id) usejson:"...,omitempty" - Tool name is snake_case (
create_data_element) - Errors returned as
Output{}, err— no panics - No direct
mcp-goimports — usespkg/chipabstractions - Client calls go through
pkg/clients/CreateDataElement -
Permissionsincludes"dgc.ai-copilot" - Registered in
register.go
Independent Test Results
| Check | Result |
|---|---|
go build ./cmd/chip |
✅ Pass |
go test ./pkg/tools/create_data_element/... |
✅ 8/8 tests pass |
go test ./... |
✅ All packages pass |
golangci-lint run ./... |
✅ Clean |
factory mcp-list |
✅ Tool registered |
factory mcp-call (happy path) |
✅ Returns error from API (expected with test UUIDs) |
Adversarial Testing (8 edge cases)
| Input | Result |
|---|---|
Empty name ("") |
✅ "name is required" |
Empty domain_id ("") |
✅ "domain_id is required" |
Missing name field entirely |
✅ MCP schema validation rejects |
Empty {} input |
✅ MCP schema rejects (missing name, domain_id, type_id) |
Unicode + HTML in name (🔥 <script>) |
✅ API returns 400, handled gracefully |
Malformed UUIDs (not-a-uuid) |
✅ API returns 400, handled gracefully |
| Very long name (5000 chars) | ✅ API returns 400, handled gracefully |
| Empty optional fields | ✅ API returns 400, handled gracefully |
No panics, no unhelpful errors — all edge cases handled cleanly.
Observations (non-blocking)
-
type_idas required input vs. spec wording: The spec says "typeId set to the Data Element asset type" which could imply the tool should auto-set this value. However, the current implementation requires the caller to provide it, which is consistent with the existing codebase pattern — no other tool hardcodes asset type IDs. The caller can useasset_types_listto look it up. This is a reasonable design choice. -
Generic error on some 400 responses: When the API returns a 400 without a
"message"field in the response body, the error shows"unexpected status: 400"rather than including the full error body. Minor improvement opportunity for future iteration (e.g., including the raw body orerrorCodefield).
Test Coverage
The test file covers: success, optional fields, missing name, missing domain_id, duplicate name conflict (400), unauthorized (401), forbidden (403), and server error (500). Solid coverage.
Files Reviewed
pkg/tools/create_data_element/tool.go— Tool implementationpkg/tools/create_data_element/tool_test.go— Unit tests (8 tests)pkg/clients/create_data_element_client.go— API clientpkg/tools/register.go— Tool registration
Summary
Add
create_data_elementMCP tool to Chip.Generated by chip-factory pipeline.