INNER CODE UNIT · JavaScript
registerTools
furey/mongodb-lens · mongodb-lens.js:1343
const registerTools = (server) => {
if (isDisabled('tools', 'all')) {
log('All MCP tools disabled via configuration', true)
return
}
if (!isDisabled('tools', 'connect-mongodb')) {
server.tool(
'connect-mongodb',
'Connect to a different MongoDB URI or alias',
{
uri: z.string().min(1).describe('MongoDB connection URI or alias to connect to'),
validateConnection: createBooleanSchema('Whether to validate the connection', 'true')
},
async ({ uri, validateConnection }) => {
return withErrorHandling(async () => {
try {
const processedUri = ensureValidMongoUri(uri)