Skip to content

Error loading MCP tool parameters when .type property value is an array #691

@benbp

Description

@benbp

Version

IntelliJ IDEA 2025.2.1 (Ultimate Edition)
Build #IU-252.25557.131, built on August 27, 2025
Source revision: ee1e6cb62e111
Licensed to Trial User
Subscription is active until October 10, 2025.
Runtime version: 21.0.8+1-b1038.68 amd64 (JCEF 122.1.9)
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Toolkit: sun.awt.windows.WToolkit
Windows 11.0
GC: G1 Young Generation, G1 Concurrent GC, G1 Old Generation
Memory: 2048M
Cores: 22
Registry:
ide.experimental.ui=true
Non-Bundled Plugins:
com.github.copilot (1.5.56-243)
Kotlin: 252.25557.131-IJ

Description

The chat plugin errors when loading an MCP server tool with parameters that have a .type property that is an array and not string. The resulting behavior is the MCP server starting in the Copilot MCP Log, but the MCP server and tools do not show up in the tools list in the chat view. From the plugin trace logs:

2025-09-11 15:37:46,006 [ 439679] WARN - #com.github.copilot.mcp.agent.lsp.LspGetToolsNotificationListener - failed to handle MCP tools notification
com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected STRING but was BEGIN_ARRAY at path $.servers[0].tools[31].inputSchema.properties..type

The MCP schema appears to support any object type for the whole parameter property (https://github.com/modelcontextprotocol/modelcontextprotocol/blob/main/schema/2025-06-18/schema.json#L2373-L2377), without any more specificity. I assume this is an issue with the plugin and not the schema or my server because other MCP clients work fine (vscode, etc.).

Below is an example of tool parameter properties returned from the tools/list call that reproduces the issue. Using "type": "boolean" works but "type": ["boolean","null"] will crash the plugin.

"fullyCompatible": {
  "description": "Indicates whether the generated TypeSpec project should be fully compatible with the swagger. It is recommended to set this to `false` so that the generated project leverages TypeSpec built-in libraries with standard patterns and templates.",
  "type": [
    "boolean",
    "null"
  ]
}

This is not really a big issue as using nullable types for server parameters is unnecessary (I am fixing here: Azure/azure-sdk-tools#12050), but the way the problem manifested was just a silent failure of the tools loading, which led me to spend a lot of time trying to debug my configuration before I got the trace logging set up.

Steps to Reproduce:

  1. Define a nullable type for a tool parameter. For example using the C# MCP SDK:
    [McpServerTool]
    public async Task<string> FooBar(boolean? fooArg) { ... }
    
  2. Run the MCP server within IntelliJ/copilog chat plugin.
  3. Optionally add com.github.copilot:trace to the intelliJ diagnostic log configuration to get the error message pasted above.

Copilot plugin trace logs attached.

copilot-plugin-tools-list-array-type-failure.log.txt

Metadata

Metadata

Assignees

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions