Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(tools): evaluate\selector\screenshot #10

Merged
merged 5 commits into from
Apr 13, 2025

Conversation

zeoxisca
Copy link

@zeoxisca zeoxisca commented Apr 2, 2025

  • beautify tool key, use global const key to constraint tool name
  • add createTab\evaluate\selector\screenshot handler functions

@Fly-Playgroud
Copy link
Collaborator

LGTM

tools/common.go Outdated
)
)

type ToolHandler = func(rodCtx *types.Context) func(context.Context, mcp.CallToolRequest) (*mcp.CallToolResult, error)

var (
CreateTabHandler = func(rodCtx *types.Context) func(context.Context, mcp.CallToolRequest) (*mcp.CallToolResult, error) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

CreateTableHandler seems to duplicate the Navigation function. So far, do you want to open multiple pages in a browser at the same time?

Copy link
Author

@zeoxisca zeoxisca Apr 3, 2025

Choose a reason for hiding this comment

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

multiple pages must be taken into account

Copy link
Collaborator

Choose a reason for hiding this comment

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

multiple pages must be taken into account

Of course, it in the plan. however, there are some problems with your implementation: we should think that mange the all pages, not replace old page with new page.

Copy link
Collaborator

@Fly-Playgroud Fly-Playgroud left a comment

Choose a reason for hiding this comment

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

I suggest splitting Pr first and submitting it in batches. 'beautify tool key', this item make a single pr.

@Fly-Playgroud
Copy link
Collaborator

I suggest turning off this PR. You can add a new PR except for createTab.

@Fly-Playgroud Fly-Playgroud self-requested a review April 11, 2025 07:30
@zeoxisca
Copy link
Author

Done, createTab removed

@zeoxisca zeoxisca changed the title feat(tools): createTab\evaluate\selector\screenshot feat(tools): evaluate\selector\screenshot Apr 13, 2025
types/context.go Outdated
@@ -74,6 +75,7 @@ type Context struct {
config Config
browser *rod.Browser
page *rod.Page
element *rod.Element
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do you add this what do you want to do? I didn't see where it were used

tools/common.go Outdated
Comment on lines 225 to 227
if element == nil || element.Object == nil {
return nil, errors.New(fmt.Sprintf("Failed to find element %s: %s", selector, err.Error()))
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

here has some problems?

tools/common.go Outdated
Comment on lines 199 to 201
if element == nil || element.Object == nil {
return nil, errors.New(fmt.Sprintf("Failed to find element: %s", selector))
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

the same as fill handler

@Fly-Playgroud Fly-Playgroud merged commit 7ad6c51 into go-rod:main Apr 13, 2025
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.

2 participants