Skip to main content
Glama

Windows Automation MCP Server

browser_close

Closes browser windows to manage system resources and maintain clean workspace environments during automated Windows operations.

Instructions

关闭浏览器

Input Schema

NameRequiredDescriptionDefault
sessionIdNo会话 ID(可选)

Input Schema (JSON Schema)

{ "properties": { "sessionId": { "description": "会话 ID(可选)", "type": "string" } }, "type": "object" }

Implementation Reference

  • The core handler function for the 'browser_close' tool. It retrieves the browser instance by sessionId, closes it using Puppeteer, cleans up internal storage maps, and returns a success or error response.
    async closeBrowser(sessionId = 'default') { try { const browser = this.browsers.get(sessionId); if (!browser) { return { success: false, error: '浏览器未找到' }; } await browser.close(); this.browsers.delete(sessionId); this.pages.delete(sessionId); return { success: true, message: '浏览器已关闭', sessionId }; } catch (error) { return { success: false, error: error.message }; } }
  • The input schema and metadata definition for the 'browser_close' tool, returned by getToolDefinitions() for MCP registration.
    { name: 'browser_close', description: '关闭浏览器', inputSchema: { type: 'object', properties: { sessionId: { type: 'string', description: '会话 ID(可选)' }, }, }, },
  • Registration of the 'browser_close' handler in the executeTool switch statement, dispatching to the closeBrowser method.
    case 'browser_close': return await this.closeBrowser(args.sessionId);
  • Helper method that confirms this module handles 'browser_close' tool calls, used by the server router.
    canHandle(toolName) { const tools = ['browser_launch', 'browser_navigate', 'browser_click', 'browser_type', 'browser_screenshot', 'browser_get_text', 'browser_close']; return tools.includes(toolName); }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/eva-wanxin-git/windows-automation-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server