Skip to main content
Glama

run_drission_code

Execute DrissionPage Python code to automate Chromium, control tabs, share state across calls, and return results using preset page, browser, and context variables.

Instructions

执行 DrissionPage Python 代码(server 进程内,完整能力底座)。预置变量:page=当前tab、browser=浏览器对象、context=跨调用持久字典、DOM_TREE_JS=DOM树JS模板。预置函数:switch_tab(tab_id)、tabs()、relaunch(**opts)。⚠️ 必须用 return 返回结果。

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
codeYes要执行的 Python 代码(必须用 return 返回结果!)
timeoutNo整体兜底超时(秒,可选)。默认 120 秒。

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.2.1

TDQS

B3.2/5.0
Behavior3/5

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

With no annotations, the description carries the full burden, and it does disclose meaningful runtime behavior: it runs server-side, exposes preset page/browser/context variables, and must return results. However, for arbitrary code execution it omits any warning about side effects, permissions, or failure behavior, which is a notable gap.

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?

A single dense block, front-loaded with the purpose before environment details, with no filler sentences. The ⚠️ return requirement is correctly emphasized, though the run-on layout slightly reduces scanability.

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 code-execution tool with no output schema and no annotations, the description supplies the essential execution context: environment, preset variables, preset functions, and the return convention. It is largely complete, missing only error/edge-case behavior.

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 100%, so both parameters (code, timeout) are already documented, establishing the baseline of 3. The preset variables and functions listed in the description enrich the code-writing context but do not clarify the parameters themselves beyond what the schema provides.

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

Purpose4/5

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

States a specific verb and resource ('执行 DrissionPage Python 代码') plus scope ('server 进程内'), which clearly separates it from the JS-oriented execute_js sibling. It never explicitly names an alternative, so it lands at clear-but-undifferentiated rather than a full 5.

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

Usage Guidelines2/5

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

There is no when-to-use/when-not guidance and no mention of alternatives like execute_js, run_cdp, or navigate. The phrase '完整能力底座' only hints that this is the general-purpose escape hatch; the agent must infer selection criteria on its own.

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