Help us shape the future of Go! Take the 2026 Go Developer Survey

check_mcp_args

command
v1.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 15, 2026 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Overview

check_mcp_args 检查所有 MCP 工具参数结构体(*Args / *Item)的 id 字段是否用 <entity>_id 命名, 而非裸 id。用法:go run ./scripts/check_mcp_args ./internal/mcp_tools/

背景:项目所有单实体 update/upsert 工具的参数一律用 <entity>_id(character_id / entry_id / setting_id / preference_id ...),这是与 LLM 的隐式约定——LLM 在 system prompt 引导下形成 "更新某实体就传 <entity>_id"的稳定预期。裸 id 会破坏约定,且在 rawArgs patch 模式下 (json.Unmarshal(tc.RawArgs, &entity))覆盖 entity.ID,有数据安全隐患。

例外:delete_record 是通用删除工具,多表共用一个 id 字段,裸 id 合理。 在结构体上方加 //nolint:raw_id 注释可跳过检查。

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL