Skip to main content
Glama
guanyuyan
by guanyuyan

session_import

Imports cookies from a local file into a target site's login session so authenticated pages can be accessed without making network requests during import.

Instructions

从本地文件导入 cookie 到某站登录态(仅本地文件,不发起网络请求)。

文件内容支持:session_export 导出的对象(含 cookies)、Playwright storage_state、直接的 cookie 数组,或浏览器扩展导出的 Netscape cookies.txt。

Args: url: 目标站点任一页面 URL(按域名匹配登录态)。 path: 本地文件路径(容器部署时用 docker cp 放进卷,再用容器内路径)。 session: 会话名(默认 default);与 web_fetch 使用的会话名保持一致。 replace: True 时用文件里的 cookie 整体替换该会话;默认 False 为按 (name, domain, path)合并,同名以导入值为准。

Input Schema

NameRequiredDescriptionDefault
urlYes
pathYes
replaceNo
sessionNodefault

Output Schema

NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv0.10.1

TDQS

A4.5/5.0
Behavior4/5

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

With no annotations at all, the description carries the full burden and largely meets it: it discloses that no network request is made, and critically explains the destructive semantics of replace=True (wholesale replacement of the session's cookies) versus the default merge by (name, domain, path) where imported values win on conflict. Missing only edge behaviors such as error handling for malformed files or limits on file size.

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?

Front-loaded with the core action and its key constraint, followed by supported file formats and then per-argument notes. Every section is useful, though the Args block restates types already present in the schema and could be tightened slightly.

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

Completeness5/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 zero schema documentation and no annotations, the description covers file formats, container path handling, session naming, and merge-versus-replace semantics. An output schema exists, so unexplained return values are not a gap.

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

Parameters5/5

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

Schema description coverage is 0%, so the description must supply all parameter meaning, and it does: url is domain-matched to a page, path includes a practical docker cp note for container deployments, session is named and tied to web_fetch consistency, and replace documents both its default and its exact merge semantics. This is substantially more than the schema conveys.

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 opening sentence names a specific verb (导入/import) and resource (cookie → 站点登录态) and immediately bounds the scope with '仅本地文件,不发起网络请求'. This clearly separates it from sibling tools like login (interactive auth) and session_export (the inverse direction).

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 definition establishes context well: it is the counterpart to session_export, it must share the session name used by web_fetch, and it explicitly takes a local file rather than performing network auth. It stops short of an explicit 'use login instead when...' routing statement, so a 4 rather than a 5.

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