Skip to content

Conversation

@Kylejeong2
Copy link
Member

what

updated mcp typing to use the page type from stagehand v3.0.2

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Nov 16, 2025

Greptile Overview

Greptile Summary

Updated MCP server types to use the properly exported Page type from @browserbasehq/stagehand v3.0.2, replacing the placeholder any types in StagehandSession and BrowserSession.

  • Upgraded @browserbasehq/stagehand dependency from ^3.0.1 to ^3.0.2
  • Added @types/node ^24.10.1 to devDependencies (likely pulled in as transitive dependency upgrade)
  • Replaced page: any with page: Page in src/types/types.ts (lines 9 and 25)
  • Updated lockfile to reflect dependency changes

This is a pure type safety improvement with no runtime behavior changes. The Page type was newly exported in stagehand 3.0.2, enabling proper TypeScript typing for page objects retrieved via stagehand.context.pages()[0].

Confidence Score: 5/5

  • This PR is completely safe to merge - it only improves type safety with no runtime changes
  • Score reflects that this is a straightforward type safety improvement: (1) minor semver patch version bump of stagehand from 3.0.1 to 3.0.2, (2) replacing any types with proper Page imports, (3) no logic changes whatsoever, (4) the Page type aligns with existing usage pattern where page objects are retrieved from stagehand.context.pages()[0], and (5) lockfile updates are clean with no unexpected dependency changes
  • No files require special attention

Important Files Changed

File Analysis

Filename Score Overview
package.json 5/5 Updated @browserbasehq/stagehand from ^3.0.1 to ^3.0.2 and added @types/node ^24.10.1 to devDependencies for improved TypeScript support
pnpm-lock.yaml 5/5 Lockfile updated to reflect stagehand 3.0.2 upgrade and @types/node 24.10.1 addition with transitive dependency updates
src/types/types.ts 5/5 Replaced any type with properly typed Page import from stagehand for StagehandSession.page and BrowserSession.page properties

Sequence Diagram

sequenceDiagram
    participant Client as MCP Client
    participant SM as SessionManager
    participant SH as Stagehand
    participant Types as Type System
    
    Note over Types: Before: page: any
    Note over Types: After: page: Page (from stagehand)
    
    Client->>SM: createSession()
    SM->>SH: new Stagehand(config)
    SH->>SH: init()
    SH-->>SM: stagehand instance
    SM->>SH: stagehand.context.pages()[0]
    SH-->>SM: Page object
    Note over SM,Types: Page properly typed as<br/>Page from @browserbasehq/stagehand
    SM->>SM: Store in BrowserSession<br/>{page: Page, sessionId, stagehand}
    SM-->>Client: BrowserSession (type-safe)
Loading

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 files reviewed, no comments

Edit Code Review Agent Settings | Greptile

@shrey150 shrey150 self-requested a review November 17, 2025 20:40
Copy link
Contributor

@shrey150 shrey150 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@Kylejeong2 Kylejeong2 merged commit b3b2c56 into main Nov 17, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants