Conversation
|
Thanks, Paul! |
wesleyjellis
left a comment
There was a problem hiding this comment.
One question about why we're returning locked?
I also ran claude with the goal of testing this out and found a few things:
1. search parameter is broken (both tools)
Passing any search value causes a GraphQL error:
failed to get dependencies: Message: Variable $search is declared by
ServiceDependenciesList but not used
Root cause (cmd/root.go:807-813): The MCP tool handler adds search to PayloadVariables, but the underlying GraphQL queries in dependencies.go:53 and
dependencies.go:86 only declare $after and $first — they have no $search variable. The GraphQL server rejects any undeclared variable.
Recommendation: remove the search field
2. Empty results return null instead of []
When a component has no dependencies/dependents, the response is null:
null
Root cause (cmd/root.go:820, 863): The dependencies and dependents slices are declared as var dependencies []serializedDependency (nil). When the loop finds no
edges, the slice stays nil, and json.Marshal(nil) produces null. It should be initialized as dependencies := []serializedDependency{}.
Recommendation: Initialize dependencies := []serializedDependency{}
3. Invalid service IDs silently return null instead of an error
Passing a completely invalid ID like "invalid-id-that-does-not-exist" returns null with no error, making it indistinguishable from a valid component with no dependencies. The API likely returns a null/empty service node, which produces no edges, leading to the same nil-slice-→-null outcome as bug #2.
Recommendation I think we should actually raise on this one, although I don't know we can? If not, returning [] is fine
src/cmd/root.go
Outdated
| Locked: edge.Locked, | ||
| Notes: edge.Notes, |
There was a problem hiding this comment.
These are kind of odd values to return. I think we should drop Locked, and I'm not sure what Notes contains, will have to look
There was a problem hiding this comment.
Apparently that's just what's returned by dependencies.go. We get the information on the edge (like note, locked) and ServiceId, which is just Id, and Aliases[], no name. I don't really want to muck with the opslevel-go submodule for this so this is the best we can do for now
- Validate service exists via GetService before fetching dependencies/dependents - Rename ServiceId field to ComponentId for clarity - Remove non-functional search parameter from both tools - Remove Locked field from serialized output - Use empty slice instead of nil for consistent JSON output Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: Farjaad <8631006+Farjaad@users.noreply.github.com>
No ticket:
Problem
Solution
Checklist