Skip to content

Commit 10091a1

Browse files
Fix lint issues.
1 parent c0f6676 commit 10091a1

File tree

3 files changed

+20
-10
lines changed

3 files changed

+20
-10
lines changed

src/tools/mongodb/read/collectionSearchIndexes.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,12 @@ export class CollectionSearchIndexesTool extends MongoDBToolBase {
3434
}: ToolArgs<typeof this.argsShape>): Promise<CallToolResult> {
3535
const provider = await this.ensureConnected();
3636

37-
const indexes: SearchIndex[] = (await provider.getSearchIndexes(database, collection, indexName)).map(
38-
(doc) => ({
39-
name: doc.name,
40-
latestDefinition: doc.latestDefinition,
41-
})
42-
);
37+
const indexes: SearchIndex[] = (
38+
(await provider.getSearchIndexes(database, collection, indexName)) as SearchIndex[]
39+
).map((doc) => ({
40+
name: doc.name,
41+
latestDefinition: doc.latestDefinition,
42+
}));
4343

4444
return {
4545
content: [

tests/integration/helpers.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,17 @@ export const databaseCollectionParameters: ParameterInfo[] = [
182182
{ name: "collection", type: "string", description: "Collection name", required: true },
183183
];
184184

185+
export const collectionWithSearchIndexParameters: ParameterInfo[] = [
186+
...databaseCollectionParameters,
187+
{
188+
name: "indexName",
189+
type: "string",
190+
description:
191+
"The name of the index to return information about. Returns all indexes on collection if not provided.",
192+
required: false,
193+
},
194+
];
195+
185196
export const databaseCollectionInvalidArgs = [
186197
{},
187198
{ database: "test" },

tests/integration/tools/mongodb/read/collectionSearchIndexes.test.ts renamed to tests/integration/tools/atlas-search/read/collectionSearchIndexes.test.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
1-
import { describeWithMongoDB } from "../mongodbHelpers.js";
2-
1+
import { describeWithMongoDB } from "../../mongodb/mongodbHelpers.js";
32
import {
4-
databaseCollectionParameters,
53
databaseCollectionInvalidArgs,
64
validateThrowsForInvalidArguments,
75
validateToolMetadata,
6+
collectionWithSearchIndexParameters,
87
} from "../../../helpers.js";
98

109
describeWithMongoDB("collectionSearchIndexes tool", (integration) => {
1110
validateToolMetadata(
1211
integration,
1312
"collection-search-indexes",
1413
"Describe the search indexes for a collection",
15-
databaseCollectionParameters
14+
collectionWithSearchIndexParameters
1615
);
1716
validateThrowsForInvalidArguments(integration, "collection-search-indexes", databaseCollectionInvalidArgs);
1817

0 commit comments

Comments
 (0)