-
Notifications
You must be signed in to change notification settings - Fork 10
Add a MCP server tool to retrieve the top package(s) for a use case #93
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
Comments
If we intended to leverage the search functionality we have on pub.dev, which I believe is exposed as a private API, I think we have an overall relevance score. If giving the LLM too many packages is a concern, then perhaps we should be dumb and only tell it about top 10% most popular packages. Or even just flutter favorite packages. Another option is to give the LLM a list of topics to pick from: Not all popular packages have topics yet, but many does. |
If we use topics, it would be good to include fetching the list of possible topics in the MCP API. |
If we filter we should be very clear about when and why the filtering is happening. If a user finds 0 packages through the search MCP tool and they move to pub.dev with the same search and see results they will assume it's a bug. |
In the tool response should we return more information about each package such as its API or the package examples? This could aid the AI in determining which package is the best fit, as well as help it to successfully use the package. |
I think those things should be available, but we shouldn't return them by default, so the LLM gets only what it asked for (to keep the token usage to a minimum). |
I think the question is whether or not the LLM is going to immediately ask for these things anyways. If it is, then we might as well return it as a part of the response. Especially if it wants to use that info to help choose between the options. That will end up being cheaper overall (one or more fewer inferences) |
I don't think we can say whether the LLM will immediately request them: it may just be building a pubspec and not doing any coding with the package yet, so it just needs the package name and version. You could just make it an optional argument to the tool call so that the LLM could decide if the extra information is useful or not and still be able to avoid unnecessary tokens and inferences. |
Create an MCP server tool
get_recommended_packages
that can return a list of N package names, where N is arbitrarily 0-3 (see discussion items below).Tool input:
The input spec is up for discussion (see discussion items below). IMO, option 2 is likely the proper approach if the LLM can help distill user input into categories the MCP tool can use as search queries.
Possible options:
"provides graphs for displaying various forms of data"
,"helps with writing and inspecting tests"
,"utilities for financial and economic math"
, etc.)["graphs", "data visualization"]
,["testing"]
,["finance", "economics", "mathematical computation"]
.Tool response:
Structured data including the recommended packages and their associated confidence score (how good of a match the package is for the query). This response, of course, should fit into the
CallToolResult
spec provided by thedart_mcp
APIs.Discussion items:
Tool implementation:
pubspec.yaml
files available in the associated project.Please provide feedback / edit this spec as needed: @gspencergoog @sigurdm @jonasfj @jakemac53 @natebosch @anderdobo
The text was updated successfully, but these errors were encountered: