NPE:Cannot invoke "com.fasterxml.jackson.databind.JsonNode.asText()" because the return value of "com.fasterxml.jackson.databind.JsonNode.get(String)" is null #310
Labels
bug
Something isn't working
I tried with langchain4j and npx start MCPserver
List 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());
}
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");
The text was updated successfully, but these errors were encountered: