Vino1016 commented on issue #578: URL: https://github.com/apache/flink-agents/issues/578#issuecomment-4089848911
Hi there, Thanks for your quick response and the proposed fix! I agree that validating the `required` field before passing it to the constructor is the right approach, and treating `null` as `false` aligns perfectly with the expected behavior. ### Regarding your first question: The `required` field in `PromptArgument` is indeed optional in the MCP specification. Here are the sources: 1. **MCP Concept Documentation**: The official MCP documentation (https://modelcontextprotocol.info/zh-cn/docs/concepts/prompts/) explicitly defines the `required` field as `required?: boolean`, indicating it is an optional boolean. 2. **MCP SDK Implementations**: For example, the JetBrains Kotlin SDK ([https://jetbrains.github.io/mcp-kotlin-sdk/-m-c-p%20-kotlin%20-s-d-k/org.jetbrains.kotlinx.mcp/-prompt-argument/index.html](https://jetbrains.github.io/mcp-kotlin-sdk/-m-c-p -kotlin -s-d-k/org.jetbrains.kotlinx.mcp/-prompt-argument/index.html)) defines `required` as `Boolean?`, a nullable boolean, which enforces that the field can be omitted or null. ### Regarding your second question: You're right that if a server is truly "tools-only" and does not support prompts, the `listPrompts` method should not be called due to the check added in #538. However, in practice, some MCP servers (like the Kubernetes MCP server I was testing with) **do support prompts** and return a non-empty list of prompts, but some of the arguments in those prompts omit the `required` field. As shown in the debug screenshot I provided: - The MCP server returns a `PromptArgument` with `name="namespace"`. - The `required` field is explicitly `null` (not `false`). - This causes the NPE during initialization, even though the server is not strictly "tools-only". This scenario is not hypothetical; it's a real-world case I encountered. The fix you proposed will handle this correctly by treating `null` as `false`, allowing the agent to initialize successfully. Thanks again for your help in addressing this issue! -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
