Skip to main content
Glama

search_python_output

Search text or regular expressions in Python execution output streams. Supports stream selection, query modes, and context lines.

Instructions

在一个 execution 的指定输出流中搜索文本或正则表达式。

选择与匹配

execution 的选择规则与 python_execution_status 相同;可选的 stream 值与 read_python_output 相同。query_mode="literal" 按字面文本匹配,query_mode="regex" 要求 query 是有效正则, query_mode="auto" 先按正则解释,仅在编译失败时回退到字面匹配。

命中上下文

每条命中保留原始所选流行号,并以 M 标记;前后上下文行以 C 标记。

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYes要匹配的字面文本或正则表达式。
streamNo输出流;默认 ``combined``,其余值为 ``stdout``、``stderr``、 ``result`` 与 ``traceback``。combined
executionNo要搜索的正整数执行编号。省略时使用当前记录,随后 使用最近记录。
max_charsNo每个返回行允许显示的最大字符数;必须为正数,且只 裁切响应文本。
query_modeNo匹配解释方式:``literal``、``regex`` 或 ``auto``; 默认 ``auto``。auto
ignore_caseNo为 true 时忽略大小写。
context_afterNo每个命中之后附加的相邻行数;必须大于或等于 0。
context_beforeNo每个命中之前附加的相邻行数;必须大于或等于 0。
Behavior4/5

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

With no annotations, the description bears full burden. It details query modes (literal, regex, auto with fallback), hit context marking (M/C tags), and selection behavior. This goes beyond the schema but lacks mention of performance, permissions, or side effects.

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 structured with headers and bullet points, using concise language. Each section serves a purpose. Slightly verbose due to technical details, but overall efficient.

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?

Covers all 8 parameters, execution selection, stream options, and result markings. Lacks explicit return structure details, but the context markers imply response format. Adequate for a search tool without output schema.

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 coverage is 100%, so baseline is 3. The description adds significant value by explaining how query_mode auto works (regex first, fallback to literal), the meaning of context markers, and the default stream behavior.

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 searches text or regex in a specified output stream of an execution, with detailed selection rules. It is distinct from siblings like read_python_output (which reads full output) and python_execution_status (which checks status).

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

Usage Guidelines3/5

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

The description mentions that execution selection rules are the same as python_execution_status and stream values match read_python_output, providing implicit context. However, it does not explicitly state when to prefer this tool over alternatives or include when-not-to-use guidance.

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/MichengLiang/loommux'

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