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.
18 lines (17 loc) • 658 B
JavaScript
import { z } from 'zod';
import { MCPServerTool } from './base.js';
const PresentActiveServerSchema = z.object({});
export class AcquireActiveMCPServerTool extends MCPServerTool {
name = 'get_active_mcp_server';
description = 'Get the currently active MCP (Model Context Protocol) server';
schema = PresentActiveServerSchema;
constructor(manager) {
super(manager);
}
async _call() {
if (!this.manager.activeServer) {
return `No MCP server is currently active. Use connect_to_mcp_server to connect to a server.`;
}
return `Currently active MCP server: ${this.manager.activeServer}`;
}
}