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 注释可跳过检查。
Click to show internal directories.
Click to hide internal directories.