Skip to content

McpClients bean #1393

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

McpClients bean #1393

wants to merge 3 commits into from

Conversation

jmartisk
Copy link
Collaborator

Fixes #1345

Accepting suggestions on how to make the name a bit more distinguished..

Also moves the @McpClientName annotation out of the runtime package as it is meant to be public API, hence the breaking-change label.

@jmartisk jmartisk requested review from maxandersen and geoand March 27, 2025 09:14
@jmartisk jmartisk requested a review from a team as a code owner March 27, 2025 09:14

This comment has been minimized.

@geoand
Copy link
Collaborator

geoand commented Mar 27, 2025

I personally don't find it terribly useful, but I'm dead set against it either :)

@jmartisk
Copy link
Collaborator Author

Honestly my position is similar, but @maxandersen requested it so.. ;)

@geoand
Copy link
Collaborator

geoand commented Mar 27, 2025

@maxandersen why do you need this instead of just using standard CDI features?

Copy link

quarkus-bot bot commented Mar 27, 2025

Status for workflow Build (on pull request)

This is the status report for running Build (on pull request) on commit 91b31af.

✅ The latest workflow run for the pull request has completed successfully.

It should be safe to merge provided you have a look at the other checks in the summary.

@maxandersen
Copy link
Member

see details of discussion in https://quarkusio.zulipchat.com/#narrow/channel/187038-dev/topic/mcp.20client

issue is that to use built-in CDI I either have to

  1. know the names of tools upfront; since with mcp the usecase is to be able to add additional tools in configuration that is not an option.
  2. use injection of all tools, which give me all tools but does not give me their name

Hence the ask for tools to know their name OR be able to get a map from names to the tools to use.

does that make sense?

(same issue exists for when wanting to support multiple models in quarkus l4j)

@geoand
Copy link
Collaborator

geoand commented Mar 27, 2025

use injection of all tools, which give me all tools but does not give me their name

Are you sure? You can extract the qualifiers from the instance, no?

@maxandersen
Copy link
Member

Hmm. Not something I found ? Got example ?

@geoand
Copy link
Collaborator

geoand commented Mar 31, 2025

Something like:

        boolean found = false;
        for (InstanceHandle<McpClient> handle : Arc.container().select(McpClient.class).handles()) {
            InjectableBean<McpClient> bean = handle.getBean();
            for (Annotation qualifier : bean.getQualifiers()) {
                if (qualifier instanceof McpClient mcpClient) }
                    if ("whatever".equals(name)) {
                        found = true;
                        break; 
                    }
                }
            }
        }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

have ability to get name for mcp's
3 participants