Skip to main content
Glama

ACTION_PARSE_XML

Parse an XML string and extract element text or attribute values by dot-separated tag path for use in automation workflows.

Instructions

解析 XML 字符串,按标签路径取元素文本或属性。输出:xml_parsed_value, xml_success, xml_error。匹配到多个元素时结果是 JSON 数组字符串。。字符串参数支持 ${var} 插值;结果以变量快照 JSON 返回。

Input Schema

NameRequiredDescriptionDefault
xmlYesXML 文本(支持 ${var})或存着 XML 的变量名
xpathNo点分标签路径,如 root.item.name(不是真正的 XPath);不填返回根元素全部文本
requireNo执行后要求为 true 的变量名(如 click_success),不满足按出错处理
on_errorNo节点出错时:skip=跳过继续(默认),stop=停止整个工作流
attributeNo取该属性值而不是元素文本
output_varNo结果另存到的变量名(xml_parsed_value 总会写)
node_timeout_msNo单节点超时毫秒,0=不限;默认 30 分钟

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A3.7/5.0
Behavior4/5

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

With no annotations, the description has to disclose behaviour, and it does: it names the output variables (xml_parsed_value, xml_success, xml_error), explains that multiple matches come back as a JSON array string, and says results are returned as a variable snapshot. It could say more about how writing to variables affects the workflow state, but the key observable behaviour is covered.

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 purpose comes first, then the output keys, then the multi-match behaviour, then interpolation. Every sentence carries information. Minor noise remains, such as a doubled Chinese full stop and the output list being repeated in prose.

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 seven-parameter tool with complete schema descriptions and no output schema, the description is nearly complete: it summarises the return values and the multi-match edge case. It could say more about on_error and require in workflow terms, but those are documented in the schema.

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 coverage is 100%, so all seven parameters — including the dot-path, require and on_error semantics — are already documented in the schema. The description adds only the ${var} interpolation note, which the schema also states, so it adds little beyond the schema. A 3 baseline is right.

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?

The description opens with a specific verb and resource: parse an XML string and extract element text or an attribute by tag path. That makes it easy to pick out against siblings, unlike ACTION_PARSE_JSON or ACTION_TEXT_OPERATION. It never names those neighbouring tools, though, so there is no explicit contrast.

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?

When to use the tool is only implied: you have XML text (or a variable containing XML) and need a value out of it. Nothing states when not to use it, and nothing points to ACTION_PARSE_JSON or other alternatives. The note that a missing path returns the root element's text does help with how to call it.

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