feat: add session-configurable snapshot settings via browser_configure_snapshots
Implements dynamic snapshot configuration that MCP clients can control during sessions without requiring server restarts or CLI changes. New tool: browser_configure_snapshots - Configure includeSnapshots, maxSnapshotTokens, differentialSnapshots at runtime - Changes take effect immediately for subsequent tool calls - Shows current settings when called with no parameters - Provides helpful tips and usage guidance Key improvements: 1. **Runtime Configuration**: Update snapshot behavior during active sessions 2. **Client Control**: MCP clients can adapt to different workflows dynamically 3. **Immediate Effect**: No server restart required - changes apply instantly 4. **State Tracking**: Context maintains current session configuration 5. **User Friendly**: Clear feedback on current settings and changes Updated tool descriptions: - All interactive tools now mention "configurable via browser_configure_snapshots" - Removed references to CLI-only configuration - Enhanced browser_snapshot description for explicit snapshots Benefits for users: 🔄 Dynamic configuration without restarts 🎛️ Client-controlled snapshot behavior 📊 View current settings anytime ⚡ Instant configuration changes 🎯 Adapt settings per workflow/task Example usage: ```json { "includeSnapshots": false, "maxSnapshotTokens": 25000, "differentialSnapshots": true } ``` This transforms snapshot configuration from static CLI options into a flexible session management system that adapts to client needs in real-time. Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
574fdc4959
commit
2fe8b9355c
5 changed files with 110 additions and 8 deletions
|
|
@ -636,4 +636,28 @@ export class Context {
|
|||
this._lastSnapshotFingerprint = undefined;
|
||||
this._lastPageState = undefined;
|
||||
}
|
||||
|
||||
updateSnapshotConfig(updates: {
|
||||
includeSnapshots?: boolean;
|
||||
maxSnapshotTokens?: number;
|
||||
differentialSnapshots?: boolean;
|
||||
}): void {
|
||||
// Update configuration at runtime
|
||||
if (updates.includeSnapshots !== undefined)
|
||||
(this.config as any).includeSnapshots = updates.includeSnapshots;
|
||||
|
||||
|
||||
if (updates.maxSnapshotTokens !== undefined)
|
||||
(this.config as any).maxSnapshotTokens = updates.maxSnapshotTokens;
|
||||
|
||||
|
||||
if (updates.differentialSnapshots !== undefined) {
|
||||
(this.config as any).differentialSnapshots = updates.differentialSnapshots;
|
||||
|
||||
// Reset differential state when toggling
|
||||
if (updates.differentialSnapshots)
|
||||
this.resetDifferentialSnapshot();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue