Skip to content

[Bug] Validation error on kintone-get-form-fields with Related Records field (REFERENCE_TABLE) #237

@nishikun19361

Description

@nishikun19361

Summary

kintone-get-form-fields ツールを使用した際、対象のアプリに関連レコード一覧フィールド(type: REFERENCE_TABLE)が含まれていると、レスポンスのバリデーション(Zod)でエラーが発生し、情報の取得に失敗します。

Target Version

1.3.1

Reproduction

  1. 関連レコード一覧フィールド(REFERENCE_TABLE)を含むKintoneアプリを用意します。(例:「労務マスタ」アプリ内に「顧客マスタ」参照フィールドを作成)
  2. @kintone/mcp-server (v1.3.1) を起動します。
  3. 当該アプリIDに対して kintone-get-form-fields ツールを実行します。

Expected Behavior

関連レコード一覧フィールドの設定情報を含め、フォームのフィールド一覧がZodバリデーションエラーにならず、正常にJSONとして返却されること。

Actual Behavior

MCPサーバー内部で以下のZodバリデーションエラーが発生し、ツール実行が失敗しました。
properties 配下のフィールドにおいて、type REFERENCE_TABLE が期待されるUnion型(RECORD_NUMBER, SINGLE_LINE_TEXT 等)のいずれにも一致しないというエラーです。

MCP error -32602: Output validation error: Invalid structured content for tool kintone-get-form-fields: [
  {
    "code": "invalid_union",
    "unionErrors": [
      {
        "issues": [
          {
            "received": "REFERENCE_TABLE",
            "code": "invalid_enum_value",
            "options": ["NUMBER", "SINGLE_LINE_TEXT"],
            "path": ["properties", "顧客マスタ", "type"],
            "message": "Invalid enum value. Expected 'NUMBER' | 'SINGLE_LINE_TEXT', received 'REFERENCE_TABLE'"
          }
        ],
        "name": "ZodError"
      }
    ],
    "path": ["properties", "顧客マスタ"],
    "message": "Invalid input"
  }
]

mcp_config.json

{
  "mcpServers": {
    "kintone": {
      "type": "stdio",
      "command": "npx.cmd",
      "args": [
        "-y",
        "@kintone/mcp-server"
      ],
      "env": {
        "KINTONE_BASE_URL": "https://xxxxxxx.cybozu.com",
        "KINTONE_USERNAME": "xxxx@example.com",
        "KINTONE_PASSWORD": "xxxxxxxxx"
      },
      "disabledTools": [
        "kintone-delete-records",
        "kintone-update-records"
      ]
    }
  }
}

Environment

  • @kintone/mcp-server: 1.3.1
  • Windows11
  • Antigravity
  • バージョン: Antigravity
  • コミット: 1.13.3

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions