Skip to content

NPE:Cannot invoke "com.fasterxml.jackson.databind.JsonNode.asText()" because the return value of "com.fasterxml.jackson.databind.JsonNode.get(String)" is null #310

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
abinggo opened this issue Apr 18, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@abinggo
Copy link

abinggo commented Apr 18, 2025

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());
}

        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");

@abinggo abinggo added the bug Something isn't working label Apr 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant