microsoft / microsoft/mcp

Azure MCP doesn't support JSON parameters

Open
#220 1 comment 0 reactions 1 assignee Claimed by @regexrowboat View on GitHub
bug server-Azure.Mcp tools-Core
Dominant language
C#
Stars
3.7k
Forks
624
Avg merge
2d 20h
Merged PRs (30d)
220

Description

You currently cannot make a tool that takes a JSON object or array as a parameter.

This is problematic because MCP protocol itself supports JSON objects.

Instead, we get a parsing error if we try to pass JSON parameters:

Message: 
System.InvalidOperationException : The requested operation requires an element of type 'String', but the target element has type 'Object'.

Stack Trace: 
ThrowHelper.ThrowJsonElementWrongTypeException(JsonTokenType expectedType, JsonTokenType actualType)
JsonDocument.GetString(Int32 index, JsonTokenType expectedType)
<>c.b__0_1(JsonElement e) line 45
IEnumerableSelectIterator`2.MoveNext()
String.Join(String separator, IEnumerable`1 values)
CommandExtensions.ParseFromDictionary(Command command, IReadOnlyDictionary`2 arguments) line 45
CommandFactoryToolLoader.CallToolHandler(RequestContext`1 request, CancellationToken cancellationToken) line 108
CompositeToolLoader.CallToolHandler(RequestContext`1 request, CancellationToken cancellationToken) line 137
McpRuntime.CallToolHandler(RequestContext`1 request, CancellationToken cancellationToken) line 76

I'm currently trying to add a tool that needs to take a list of JSON objects as a parameter For example:

data-sets: [
{
"table": "requests",
"filters": "success=false",
"splitBy": "resultCode"
}
]

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.