@@ -14,14 +14,11 @@ import '../utils/json.dart';
1414/// Limit the number of concurrent requests.
1515final _pool = Pool (10 );
1616
17- /// The number of reults to return for a query.
17+ /// The number of results to return for a query.
1818// If this should be set higher than 10 we need to implement paging of the
1919// http://pub.dev/api/search endpoint.
2020final _resultsLimit = 10 ;
2121
22- /// The number of identifiers we list per packages.
23- final _maxIdentifiersListed = 200 ;
24-
2522/// Mix this in to any MCPServer to add support for doing searches on pub.dev.
2623base mixin PubDevSupport on ToolsSupport {
2724 final _client = Client ();
@@ -56,7 +53,7 @@ base mixin PubDevSupport on ToolsSupport {
5653 return CallToolResult (
5754 content: [
5855 TextContent (
59- text: 'No packages mached the query, consider simplifying it.' ,
56+ text: 'No packages matched the query, consider simplifying it.' ,
6057 ),
6158 ],
6259 isError: true ,
@@ -80,9 +77,6 @@ base mixin PubDevSupport on ToolsSupport {
8077 (packageName) => (
8178 versionListing: retrieve ('api/packages/$packageName ' ),
8279 score: retrieve ('api/packages/$packageName /score' ),
83- docIndex: retrieve (
84- 'documentation/$packageName /latest/index.json' ,
85- ),
8680 ),
8781 )
8882 .toList ();
@@ -94,18 +88,6 @@ base mixin PubDevSupport on ToolsSupport {
9488 final packageName = packageNames[i];
9589 final versionListing = await subQueryFutures[i].versionListing;
9690 final scoreResult = await subQueryFutures[i].score;
97- final docIndex = await subQueryFutures[i].docIndex;
98-
99- Map <String , Object ?> identifiers (Object index) {
100- final items = dig <List >(index, []);
101- return {
102- 'qualifiedNames' : [
103- for (final item in items.take (_maxIdentifiersListed))
104- dig <String >(item, ['qualifiedName' ]),
105- ],
106- };
107- }
108-
10991 results.add (
11092 TextContent (
11193 text: jsonEncode ({
@@ -144,7 +126,6 @@ base mixin PubDevSupport on ToolsSupport {
144126 .where ((t) => (t as String ).startsWith ('publisher:' ))
145127 .firstOrNull,
146128 },
147- if (docIndex != null ) ...{'api' : identifiers (docIndex)},
148129 }),
149130 ),
150131 );
@@ -164,8 +145,7 @@ base mixin PubDevSupport on ToolsSupport {
164145 description:
165146 'Searches pub.dev for packages relevant to a given search query. '
166147 'The response will describe each result with its download count, '
167- 'package description, topics, license, publisher, and a list of '
168- 'identifiers in the public api.' ,
148+ 'package description, topics, license, and publisher.' ,
169149 annotations: ToolAnnotations (title: 'pub.dev search' , readOnlyHint: true ),
170150 inputSchema: Schema .object (
171151 properties: {
0 commit comments