Skip to main content
Glama

page_callMethod

Call a method on the current page instance with provided arguments and return the result. Use to trigger page logic instead of directly modifying data.

Instructions

调用当前页面实例上暴露的方法(等价 page.callMethod(method, ...args),会 await 结果)。args[] 按位置展开为实参(非命名参数;传一个对象就是第一个位置参数)。返回 {method,arguments,result},result 为方法返回值。何时用:触发页面真实逻辑(优于直接 page_setData 改状态);调组件实例方法用 element_callMethod。方法不存在或内部抛错会以 UserError 返回失败信息。

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
argsNo
methodYes
maxBytesNo
connectionNo可选连接覆盖(不传则用默认会话)。可用字段:mode(launch|connect)、cliPath、projectPath、wsEndpoint、timeout、port(【自动化端口】→ cli auto --auto-port,默认 9420;不是 IDE HTTP 服务端口,别把 IDE 服务端口传进来)、account、ticket、trustProject、args、cwd、autoClose、autoLaunch、launchTimeout、connectTimeout。
Behavior4/5

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

With no annotations provided, the description discloses key behaviors: the call is awaited, args are positional, return structure includes method/arguments/result, and errors return UserError. However, it does not mention potential side effects on page state, though this might be implicit for method calls.

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

Conciseness4/5

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

The description is concise (about 120 characters) and front-loads the main action. It could be more structured, but it avoids redundancy and waste.

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?

Given no output schema, the description covers the return structure and error handling. It distinguishes from sibling tools and explains usage context. Missing details on maxBytes and connection semantics slightly reduce completeness.

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

Parameters3/5

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

Schema description coverage is only 25% (only connection field described). The description adds meaning: args are positional (not named), method is the method name. But it does not explain maxBytes or connection in detail beyond the schema, leaving some parameters under-documented.

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 the tool 'calls a method exposed on the current page instance' and explicitly distinguishes from the sibling 'element_callMethod' for component instances. The verb 'call' and resource 'page method' are specific.

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

Usage Guidelines5/5

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

The description provides explicit guidance: use when triggering real page logic (better than page_setData) and use element_callMethod for component methods. It also mentions error handling with UserError for missing methods or internal errors.

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/Chaixueyuan/weapp-agent-mcp'

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