Skip to main content
Glama

mp_currentPage

Retrieve current page path, query, size, and scroll position from a WeChat mini-program. Optionally extract specific data fields to capture a snapshot of page state for debugging or automation.

Instructions

获取当前页面信息(path、query、size、scrollTop)。withData=true 额外返回 page.data。

何时用:想一次拿“路由 + 尺寸/滚动 + 部分 data”的概览时。 何时改用别的:只想读 data 字段 → 用 page_getData;想断言/等待某个路由 → 用 page_expectRoute / page_waitRoute(它们已替你处理路由滞后),不要在这里读 path 再手动比较。

⚠️ 路由滞后:path 来自 SDK currentPage() 句柄,是快照型,仅在“刚做完快速 navigate / reLaunch / switchTab 的那一瞬间”可能落后于真实路由;稳态下可信。刚导航完一般不用调本工具——mp_navigate 返回的 activePage 已经可信。只有在确实怀疑该瞬间滞后时,才用 mp_evaluate 跑 return getCurrentPages().slice(-1)[0].route 交叉校验,别默认每次都加这步。

参数:dataPaths 只取关键字段、避免大数组爆 token,支持点路径、数组下标(含负数如 [-1])、.length、以及通配 [*](如 ['conversationHistory[*].aiStatus','isSearching']);解析不到的路径会进返回里的 missingPaths。maxBytes 默认 50000,超出按字节截断并置 truncated=true,字节数见 bytes(字段名与 page_getData 一致)。connection 可选。

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
maxBytesNo
withDataNo
dataPathsNo
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?

No annotations provided; description compensates by discussing routing lag (snapshot behavior), truncation via maxBytes, and cross-validation with mp_evaluate. Does not explicitly state non-destructive nature but implies it. Lacks mention of error handling or permissions.

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?

Description is fairly long but well-structured with sections for purpose, usage, warnings, and parameter details. Front-loaded with main purpose. Could be slightly more concise but retains necessary detail.

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

Completeness3/5

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

No output schema, but description mentions missingPaths and bytes without fully specifying return structure. For a tool of moderate complexity, it provides enough context for an agent, but explicit return format would improve completeness.

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?

Schema has 4 params with only 25% description coverage. Description adds meaning for dataPaths (path expressions, wildcards, missing), maxBytes (default 50000, truncation, bytes field), withData, and connection. Adequately compensates for low schema coverage.

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?

Description clearly states it gets current page info (path, query, size, scrollTop) and optionally page.data. It distinguishes from siblings like page_getData, page_expectRoute, page_waitRoute.

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?

Explicitly says when to use (概览 of route, size, scroll, partial data) and when to use alternatives (page_getData for data only, page_expectRoute/page_waitRoute for route assertion). Also warns about routing lag and not using right after navigation.

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