• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

mongodb-js / mongodb-mcp-server / 14640623132

24 Apr 2025 11:35AM UTC coverage: 77.5% (+1.7%) from 75.815%
14640623132

Pull #102

github

nirinchev
post-rebase fixes
Pull Request #102: chore: add tests for read operations

107 of 191 branches covered (56.02%)

Branch coverage included in aggregate %.

6 of 6 new or added lines in 3 files covered. (100.0%)

637 of 769 relevant lines covered (82.83%)

39.1 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

70.0
/src/tools/mongodb/update/renameCollection.ts
1
import { z } from "zod";
27✔
2
import { CallToolResult } from "@modelcontextprotocol/sdk/types.js";
3
import { MongoDBToolBase } from "../mongodbTool.js";
27✔
4
import { ToolArgs, OperationType } from "../../tool.js";
5

6
export class RenameCollectionTool extends MongoDBToolBase {
27✔
7
    protected name = "rename-collection";
23✔
8
    protected description = "Renames a collection in a MongoDB database";
23✔
9
    protected argsShape = {
23✔
10
        collection: z.string().describe("Collection name"),
11
        database: z.string().describe("Database name"),
12
        newName: z.string().describe("The new name for the collection"),
13
        dropTarget: z.boolean().optional().default(false).describe("If true, drops the target collection if it exists"),
14
    };
15
    protected operationType: OperationType = "update";
23✔
16

17
    protected async execute({
18
        database,
19
        collection,
20
        newName,
21
        dropTarget,
22
    }: ToolArgs<typeof this.argsShape>): Promise<CallToolResult> {
23
        const provider = await this.ensureConnected();
×
24
        const result = await provider.renameCollection(database, collection, newName, {
×
25
            dropTarget,
26
        });
27

28
        return {
×
29
            content: [
30
                {
31
                    text: `Collection \`${collection}\` renamed to \`${result.collectionName}\` in database \`${database}\`.`,
32
                    type: "text",
33
                },
34
            ],
35
        };
36
    }
37
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc