Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 18 additions & 13 deletions tests/benchmark/adapters/openchrome-adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@ export interface OpenChromeAdapterOptions {
* Returns mock responses without connecting to a real MCP server.
* Use for deterministic tool call count and regression testing.
*/
export class OpenChromeStubAdapter implements MCPAdapter {
name = 'OpenChrome';
mode: string;
private options: OpenChromeAdapterOptions;
export class OpenChromeStubAdapter implements MCPAdapter {
name = 'OpenChrome';
mode: string;
private options: OpenChromeAdapterOptions;
private tabSeq = 0;

private _totalInputChars = 0;
private _totalOutputChars = 0;
Expand All @@ -37,9 +38,12 @@ export class OpenChromeStubAdapter implements MCPAdapter {
this._totalInputChars += inputJson.length;

// Stub response - no actual MCP server connection
const result: MCPToolResult = {
content: [{ type: 'text', text: 'stub response' }],
};
const text = toolName === 'tabs_create'
? JSON.stringify({ tabId: `stub-${this.mode}-tab-${++this.tabSeq}` })
: 'stub response';
const result: MCPToolResult = {
content: [{ type: 'text', text }],
};

const outputJson = JSON.stringify(result);
this._totalOutputChars += outputJson.length;
Expand All @@ -60,12 +64,13 @@ export class OpenChromeStubAdapter implements MCPAdapter {
return this._toolCallCount;
}

resetMetrics(): void {
this._totalInputChars = 0;
this._totalOutputChars = 0;
this._toolCallCount = 0;
}
}
resetMetrics(): void {
this._totalInputChars = 0;
this._totalOutputChars = 0;
this._toolCallCount = 0;
this.tabSeq = 0;
}
}

/**
* @deprecated Use OpenChromeStubAdapter instead.
Expand Down
Loading
Loading