Skip to content

Add Service Dependency Support#99

Merged
wesleyjellis merged 5 commits intomainfrom
p25marti/service-dependency-support
Feb 18, 2026
Merged

Add Service Dependency Support#99
wesleyjellis merged 5 commits intomainfrom
p25marti/service-dependency-support

Conversation

@p25marti
Copy link
Contributor

@p25marti p25marti commented Feb 11, 2026

No ticket:

Problem

  • Allow the MCP server to query for Service dependencies and dependants
  • cc: Soufiane Amanzoul made these changes with Claude Code, I'm just pushing them up for him!

Solution

Checklist

  • I have run this code, and it appears to resolve the stated issue.
  • This PR has no user interface changes or has already received approval from product management to change the interface.
  • Make a changie entry that explains the customer facing outcome of this change.

@souf-gmail
Copy link

Thanks, Paul!

Copy link
Contributor

@wesleyjellis wesleyjellis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Comment on lines 826 to 827
Locked: edge.Locked,
Notes: edge.Notes,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

even Aliases is odd

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

wesleyjellis and others added 2 commits February 18, 2026 09:24
- 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>
wesleyjellis and others added 2 commits February 18, 2026 11:00
Co-authored-by: Farjaad <8631006+Farjaad@users.noreply.github.com>
@wesleyjellis wesleyjellis merged commit b7bb183 into main Feb 18, 2026
1 check passed
@wesleyjellis wesleyjellis deleted the p25marti/service-dependency-support branch February 18, 2026 18:32
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.

4 participants

Comments