Closed
Description
I tried with langchain4j and npx start MCPserver
List<String> command = List.of(
"npx",
"-y",
"@modelcontextprotocol/server-github"
);
Map<String, String> environment = Map.of(
"GITHUB_PERSONAL_ACCESS_TOKEN
But I find The Json return structure of the 19th tool has an Array type inside.
"comments": {
"type": "array",
"items": {
"anyOf": [
{
"type": "object",
"properties": {
"path": {
"type": "string",
"description": "The relative path to the file being commented on"
},
"position": {
"type": "number",
"description": "The position in the diff where you want to add a review comment"
},
"body": {
"type": "string",
"description": "Text of the review comment"
}
},
"required": [
"path",
"position",
"body"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"path": {
"type": "string",
"description": "The relative path to the file being commented on"
},
"line": {
"type": "number",
"description": "The line number in the file where you want to add a review comment"
},
"body": {
"type": "string",
"description": "Text of the review comment"
}
},
"required": [
"path",
"line",
"body"
],
"additionalProperties": false
}
]
},
"description": "Comments to post as part of the review (specify either position or line, not both)"
}
},
But when parsing Json
else if (nodeType.equals("array")) {
JsonArraySchema.Builder builder = JsonArraySchema.builder();
if (node.has("description")) {
builder.description(node.get("description").asText());
}
builder.items(jsonNodeToJsonSchemaElement(node.get("items")));
return builder.build();
The element obtained is an array, and the type and "description" in it cannot be obtained.
String nodeType = node.get("type").asText();JsonNode description = node.get("description");