Skip to main content
Glama

localizationDelete

Remove translation entries for specific keys from localization files to manage multilingual content effectively.

Instructions

刪除指定Key的翻譯項目

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
filePathYes
keyYes

Implementation Reference

  • The main handler function that implements the deletion logic: loads CSV data from cache/file, finds the entry by key, removes it, and writes back to the file updating cache.
    static async deleteEntry(filePath: string, key: string): Promise<string> {
      try {
        const records = await this.getCSVData(filePath);
    
        // 找到要刪除的項目索引
        const index = records.findIndex(entry => entry.Key === key);
        if (index === -1) {
          return `錯誤: Key "${key}" 不存在`;
        }
    
        // 刪除項目
        records.splice(index, 1);
    
        // 寫回檔案並更新緩存
        await this.writeCSVData(filePath, records);
    
        return `成功刪除Key "${key}"`;
      } catch (error) {
        console.error(`刪除翻譯項失敗: ${error instanceof Error ? error.message : '未知錯誤'}`);
        throw error;
      }
    }
  • main.ts:398-413 (registration)
    Registers the 'localizationDelete' tool with the MCP server, defining input schema and wrapping the LocalizationTool.deleteEntry handler.
    server.tool("localizationDelete",
        "刪除指定Key的翻譯項目",
        { filePath: z.string(), key: z.string() },
        async ({ filePath, key }) => {
            try {
                const result = await LocalizationTool.deleteEntry(filePath, key);
                return {
                    content: [{ type: "text", text: result }]
                };
            } catch (error) {
                return {
                    content: [{ type: "text", text: `刪除失敗: ${error instanceof Error ? error.message : "未知錯誤"}` }]
                };
            }
        }
    );
  • Zod input schema validation for the tool: filePath (string) and key (string).
    { filePath: z.string(), key: z.string() },
  • TypeScript interface defining the structure of a localization entry in the CSV.
    export interface LocalizationEntry {
      Key: string;
      'zh-TW': string;
      'zh-CN': string;
      en: string;
      [key: string]: string; // 其他可能的語言欄位
    }
Behavior2/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. It states it's a deletion operation, implying it's destructive, but doesn't disclose critical behavioral traits like whether the deletion is permanent, requires specific permissions, affects other data, or has side effects. This is inadequate for a mutation tool with zero annotation coverage.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that directly states the tool's purpose without any wasted words. It is appropriately sized and front-loaded, making it easy to parse quickly.

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

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given this is a destructive tool with no annotations, 0% schema coverage, and no output schema, the description is incomplete. It lacks information on behavioral risks, parameter meanings, expected outcomes, or error handling, which are essential for safe and effective use.

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

Parameters2/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 compensate, but it only mentions '指定Key' (specified key) implicitly, without explaining the 'filePath' parameter or providing any details on parameter formats, constraints, or examples. This leaves both parameters largely undocumented.

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 clearly states the action ('刪除' meaning 'delete') and the resource ('指定Key的翻譯項目' meaning 'translation item for specified key'), which is specific and unambiguous. However, it doesn't explicitly differentiate from sibling tools like 'localizationDelete' vs 'delete_from_file' or 'codeLineDelete', though the 'localization' context helps.

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?

No guidance is provided on when to use this tool versus alternatives like 'localizationUpdate' or 'delete_from_file'. The description only states what it does, leaving the agent to infer usage from the tool name and context with other localization tools.

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/GonTwVn/GonMCPtool'

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