Skip to main content
Glama
cht-codeini

i18n-file-replace-mcp

by cht-codeini

i18n 文件替换预览

preview_replace

Preview i18n file replacement results before applying changes. Provide file content and configuration to see generated keys, original and new content without modifying the repository.

Instructions

预览 i18n 文件替换结果,不写入资源库。返回 originalContent、content、generatedKeys 与 keyCount。需配置环境变量 I18N_API_KEY。 必须提供 configJson 或 profileName 之一。

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
contentYes要替换的文件完整内容
fileNameYes被替换文件的名称,用于生成 key(如 Home.vue;带目录前缀如 pages/member/list.vue 时 key 会包含目录信息)
configJsonNo替换配置 JSON(I18nReplaceConfigDto,与 profileName 二选一,优先级更高)
profileNameNo平台上已保存的配置名(与 configJson 二选一)
resourceSetNo非空时将生成的 key 写入该资源集(写入平台数据库,LocaleId=zh)
resourceSetByDirNo为 true 且提供了 resourceSet 时,实际资源集为 <resourceSet>.<fileName 的第一级目录>(与 CLI --resource-set-by-dir 一致,如 portal.member);fileName 无目录前缀时退化为 resourceSet 本身

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.2.1

TDQS

A4.3/5.0
Behavior4/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It effectively covers this: states the tool is non-destructive (does not write), declares the environment variable requirement (I18N_API_KEY), discloses the returned fields, and flags the configJson/profileName mutual-exclusivity constraint. This is solid coverage for a preview tool.

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?

Three sentences with the core purpose and non-destructive trait front-loaded, followed by return values and requirements. There is no filler, and every clause earns its place. It could be marginally tighter, but it is well-organized and scannable.

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 6-parameter tool with no output schema and no annotations, the description covers the essentials: purpose, side-effect-free behavior, return fields (which substitutes for the missing output schema), environment prerequisite, and the parameter constraint. Minor gaps are acceptable given the schema already documents parameters fully.

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 description coverage is 100%, so the schema already documents every parameter well (baseline 3). The description adds genuine value by stating '必须提供 configJson 或 profileName 之一' — a one-of requirement that the schema itself does not encode (neither is in the required list). This prevents an agent from calling with only fileName+content.

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 states a specific verb (preview/replace), the resource (i18n files), and the key behavioral trait that distinguishes it from the write-sibling: '不写入资源库' (does not write to the repository). It also names the return fields, making the tool's scope unambiguous even among siblings like replace_file.

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 description clearly conveys the preview-only context ('预览...不写入资源库'), which implicitly tells an agent to use this tool when it wants to inspect a replacement before committing. However, it does not explicitly name the alternative (replace_file) or state when-not-to-use, leaving the sibling differentiation to inference.

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