Skip to content

fix: updates count tool #254

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

Merged
merged 9 commits into from
May 20, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/tools/mongodb/read/count.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,14 @@ export const CountArgs = {
.record(z.string(), z.unknown())
.optional()
.describe(
"The query filter to count documents. Matches the syntax of the filter argument of db.collection.count()"
"A filter/query parameter. Allows users to filter the documents to count. Matches the syntax of the filter argument of db.collection.count()."
),
};

export class CountTool extends MongoDBToolBase {
protected name = "count";
protected description = "Gets the number of documents in a MongoDB collection";
protected description =
"Gets the number of documents in a MongoDB collection using db.collection.count() and query as an optional filter parameter";
protected argsShape = {
...DbOperationArgs,
...CountArgs,
Expand Down
25 changes: 15 additions & 10 deletions tests/integration/tools/mongodb/read/count.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,21 @@ import {
} from "../../../helpers.js";

describeWithMongoDB("count tool", (integration) => {
validateToolMetadata(integration, "count", "Gets the number of documents in a MongoDB collection", [
{
name: "query",
description:
"The query filter to count documents. Matches the syntax of the filter argument of db.collection.count()",
type: "object",
required: false,
},
...databaseCollectionParameters,
]);
validateToolMetadata(
integration,
"count",
"Gets the number of documents in a MongoDB collection using db.collection.count() and query as an optional filter parameter",
[
{
name: "query",
description:
"A filter/query parameter. Allows users to filter the documents to count. Matches the syntax of the filter argument of db.collection.count().",
type: "object",
required: false,
},
...databaseCollectionParameters,
]
);

validateThrowsForInvalidArguments(integration, "count", [
{},
Expand Down
Loading