close-browser
Stop a specific browser instance in AdsPower by providing its unique user ID using the LocalAPI MCP Server. Simplify browser management and resource optimization.
Instructions
Close the browser
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| userId | Yes | The browser id of the browser to stop, it is required when you want to stop the browser |
Input Schema (JSON Schema)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"userId": {
"description": "The browser id of the browser to stop, it is required when you want to stop the browser",
"type": "string"
}
},
"required": [
"userId"
],
"type": "object"
}
Implementation Reference
- src/handlers/browser.ts:49-54 (handler)The core handler function for the 'close-browser' tool. It makes an axios GET request to the local API endpoint to close the browser associated with the given userId and returns a success message.async closeBrowser({ userId }: CloseBrowserParams) { const response = await axios.get(`${LOCAL_API_BASE}${API_ENDPOINTS.CLOSE_BROWSER}`, { params: { user_id: userId } }); return 'Browser closed successfully'; },
- src/types/schemas.ts:108-110 (schema)Zod schema for validating the input parameters of the 'close-browser' tool, requiring a 'userId' string.closeBrowserSchema: z.object({ userId: z.string().describe('The browser id of the browser to stop, it is required when you want to stop the browser') }).strict(),
- src/utils/toolRegister.ts:14-15 (registration)Registration of the 'close-browser' tool on the MCP server, including name, description, schema, and wrapped handler.server.tool('close-browser', 'Close the browser', schemas.closeBrowserSchema.shape, wrapHandler(browserHandlers.closeBrowser));