mcp-use
Version:
A utility library for integrating Model Context Protocol (MCP) with LangChain, Zod, and related tools. Provides helpers for schema conversion, event streaming, and SDK usage.
20 lines (19 loc) • 761 B
JavaScript
import { z } from 'zod';
import { MCPServerTool } from './base.js';
const ReleaseConnectionSchema = z.object({});
export class ReleaseMCPServerConnectionTool extends MCPServerTool {
name = 'disconnect_from_mcp_server';
description = 'Disconnect from the currently active MCP (Model Context Protocol) server';
schema = ReleaseConnectionSchema;
constructor(manager) {
super(manager);
}
async _call() {
if (!this.manager.activeServer) {
return `No MCP server is currently active, so there's nothing to disconnect from.`;
}
const serverName = this.manager.activeServer;
this.manager.activeServer = null;
return `Successfully disconnected from MCP server '${serverName}'.`;
}
}