Skip to content

Conversation

@manusa
Copy link
Member

@manusa manusa commented Nov 11, 2025

Ensures #385 / #219 preserves current behavior.

Verifies that tools are added and removed when kubeconfig file changes.

Go SDK lacks a SetTools method, AddTool only upserts tools. This test verifies that internally we handle the case that no-longer applicable tools are removed from the list of tools.

@manusa manusa added this to the 0.1.0 milestone Nov 11, 2025
@manusa manusa requested review from Cali0707 and matzew November 11, 2025 14:32
Verifies that tools are added and **removed** when kubeconfig
file changes.

Signed-off-by: Marc Nuri <[email protected]>

s.Run("OpenShift tool is removed after kubeconfig change", func() {
// Reload Config without OpenShift
s.mockServer.ResetHandlers()
Copy link
Collaborator

Choose a reason for hiding this comment

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

It took me a bit, to see that it actually "reset" the handlers (while the other one accepts one handler).

I guess no major issue

Copy link
Member Author

Choose a reason for hiding this comment

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

I can try to make it clearer.
This was the easiest path I found to test the functionality.

I will probably improve the test with a custom provider to verify other behaviors such as the Provider close if exists:

// close the old provider
if s.p != nil {
s.p.Close()
}

and so on.

Bu It don't want to spend too much time on this at the moment since it's blocking #385

}

func (m *MockServer) ResetHandlers() {
m.restHandlers = make([]http.HandlerFunc, 0)
Copy link
Collaborator

Choose a reason for hiding this comment

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

there is similar code above when creating the server

@matzew
Copy link
Collaborator

matzew commented Nov 11, 2025

Go SDK lacks a SetTools method, AddTool only upserts tools.

is this worth to call out as an issue on the repo, or was already a similar issue?

@matzew
Copy link
Collaborator

matzew commented Nov 11, 2025

LGTM

@manusa
Copy link
Member Author

manusa commented Nov 11, 2025

Go SDK lacks a SetTools method, AddTool only upserts tools.

is this worth to call out as an issue on the repo, or was already a similar issue?

Once I implement the workaround here I'll open a PR upstream so it's clear what's the problem.

I was the one who actually implemented SetTools in the mark3labs repo mark3labs/mcp-go#24 in the first place :)

@matzew matzew merged commit ae6eced into containers:main Nov 11, 2025
6 checks passed
@manusa manusa deleted the test/tools-reload branch November 12, 2025 05:26
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.

2 participants