Skip to main content
Glama

ruyi_evaluate_script

Executes JavaScript functions in a browser page and returns JSON-safe results. Use for runtime sampling, hook injection, and reading page state.

Instructions

在浏览器页面中执行 JavaScript 函数并返回结果。可用于运行时采样、Hook 注入、读取页面状态。函数必须返回 JSON-safe 值。支持接收本地文件作为参数。

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pageIdxNo标签页索引,默认当前活跃页
sandboxNoBiDi sandbox 名称(隔离执行上下文)
timeoutNo超时(秒),默认 10
functionYes要执行的 JavaScript 函数声明。例: "() => { return document.title }" 或 "async () => { return await fetch('example.com') }"
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the full burden. It adds useful behavioral constraints: function must return a JSON-safe value and supports accepting a local file as a parameter. However, it does not disclose potential side effects or security implications of arbitrary JavaScript execution, nor error/timeout behavior, which are relevant for an eval tool.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is four short sentences, front-loaded with the primary action and result. Each sentence contributes new information: purpose, use cases, return constraint, and file support. No filler or redundancy.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a 4-parameter tool with no annotations or output schema, the description is reasonably complete. It covers the core action, acceptable return values, and input flexibility. It could be more complete by addressing error behavior or side-effect warnings, but the provided details are sufficient for basic selection and invocation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema already covers all 4 parameters (100% coverage), so the baseline is 3. The description adds value beyond the schema by emphasizing that the function must return a JSON-safe value and that a local file can be passed as a parameter, which are non-obvious constraints not fully captured in the property descriptions.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states a specific verb+resource: '在浏览器页面中执行 JavaScript 函数并返回结果' (execute JavaScript function in browser page and return result). It also lists concrete use cases (runtime sampling, Hook injection, reading page state) that distinguish it from sibling script-management or DOM tools.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides explicit use cases: '可用于运行时采样、Hook 注入、读取页面状态', giving clear context for when to use the tool. However, it does not explicitly name alternatives or state when not to use it, so it falls short of a 5.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Facetomyself/ruyi-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server