metrx_stop_experiment
Stop a running model routing experiment permanently while preserving results. Optionally promote the winning treatment model as the new default if it performed better.
Instructions
Stop a running model routing experiment. The experiment results are preserved. If the treatment model won, you can optionally promote it as the new default. Do NOT use for pausing experiments temporarily — stopping is permanent.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| experiment_id | Yes | The experiment ID to stop | |
| promote_winner | No | If the treatment model won, apply it as the new default model |
Implementation Reference
- src/tools/experiments.ts:167-212 (handler)The stop_experiment tool handler - takes experiment_id and optional promote_winner parameters, stops a running model routing experiment via POST to /experiments/{id}/stop endpoint
server.registerTool( 'stop_experiment', { title: 'Stop Experiment', description: 'Stop a running model routing experiment. The experiment results are preserved. ' + 'If the treatment model won, you can optionally promote it as the new default. ' + 'Do NOT use for pausing experiments temporarily — stopping is permanent.', inputSchema: { experiment_id: z.string().uuid().describe('The experiment ID to stop'), promote_winner: z .boolean() .default(false) .describe('If the treatment model won, apply it as the new default model'), }, annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false, }, }, async ({ experiment_id, promote_winner }) => { const result = await client.post<{ status: string; promoted: boolean }>( `/experiments/${experiment_id}/stop`, { promote_winner: promote_winner ?? false } ); if (result.error) { return { content: [{ type: 'text', text: `Error stopping experiment: ${result.error}` }], isError: true, }; } const d = result.data!; let text = `✅ Experiment stopped. Status: ${d.status}`; if (d.promoted) { text += '\n🔄 Treatment model has been promoted as the new default.'; } return { content: [{ type: 'text', text }], }; } ); - src/index.ts:74-103 (registration)The registration middleware that wraps server.registerTool to add the metrx_ prefix to all tool names and applies rate limiting
// ── Rate limiting middleware + metrx_ namespace prefix ── // All tools are registered exclusively as metrx_{name}. // The metrx_ prefix namespaces our tools to avoid collisions when // multiple MCP servers are used together. const METRX_PREFIX = 'metrx_'; const originalRegisterTool = server.registerTool.bind(server); (server as any).registerTool = function ( name: string, config: any, handler: (...handlerArgs: any[]) => Promise<any> ) { const wrappedHandler = async (...handlerArgs: any[]) => { if (!rateLimiter.isAllowed(name)) { return { content: [ { type: 'text' as const, text: `Rate limit exceeded for tool '${name}'. Maximum 60 requests per minute allowed.`, }, ], isError: true, }; } return handler(...handlerArgs); }; // Register with metrx_ prefix (only — no deprecated aliases) const prefixedName = name.startsWith(METRX_PREFIX) ? name : `${METRX_PREFIX}${name}`; originalRegisterTool(prefixedName, config, wrappedHandler); };