Skip to main content
Glama

emulate_cpu

Simulate CPU throttling to test web page performance under constrained processing conditions by adjusting execution slowdown factors.

Instructions

Emulates CPU throttling by slowing down the selected page's execution.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
throttlingRateYesThe CPU throttling rate representing the slowdown factor 1-20x. Set the rate to 1 to disable throttling

Implementation Reference

  • The handler function for the 'emulate_cpu' tool. It retrieves the selected page, extracts the throttlingRate from params, calls page.emulateCPUThrottling(throttlingRate), and sets the CPU throttling rate in context.
    handler: async (request, _response, context) => { const page = context.getSelectedPage(); const {throttlingRate} = request.params; await page.emulateCPUThrottling(throttlingRate); context.setCpuThrottlingRate(throttlingRate); },
  • Zod schema for the tool input, defining 'throttlingRate' as a number from 1 to 20, where 1 disables throttling.
    schema: { throttlingRate: z .number() .min(1) .max(20) .describe( 'The CPU throttling rate representing the slowdown factor 1-20x. Set the rate to 1 to disable throttling', ), },
  • The tool is defined and exported using defineTool, including name, description, annotations, schema, and handler. This serves as the registration point for the MCP tool.
    export const emulateCpu = defineTool({ name: 'emulate_cpu', description: `Emulates CPU throttling by slowing down the selected page's execution.`, annotations: { category: ToolCategories.EMULATION, readOnlyHint: false, }, schema: { throttlingRate: z .number() .min(1) .max(20) .describe( 'The CPU throttling rate representing the slowdown factor 1-20x. Set the rate to 1 to disable throttling', ), }, handler: async (request, _response, context) => { const page = context.getSelectedPage(); const {throttlingRate} = request.params; await page.emulateCPUThrottling(throttlingRate); context.setCpuThrottlingRate(throttlingRate); }, });

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/SHAY5555-gif/chrome-devtools-mcp'

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