fix: make tabName non-nullable to match runtime requirement - #110
Open
sfrmattos wants to merge 1 commit into
Open
fix: make tabName non-nullable to match runtime requirement#110sfrmattos wants to merge 1 commit into
sfrmattos wants to merge 1 commit into
Conversation
The field is declared as String? (nullable) in Kotlin data classes, which generates a JSON Schema without 'tabName' in the 'required' array. MCP clients therefore omit the field, but the Burp Montoya API runtime requires it, causing: Field 'tabName' is required for type with serial name '...', but it was missing Changing String? -> String makes isMarkedNullable() return false, which adds 'tabName' to the schema's required array. The Montoya API method sendToRepeater(HttpRequest, String) accepts any non-null String, including empty string — same semantic as the original optional behavior.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #109
Problem
The
tabNamefield inCreateRepeaterTab,CreateRepeaterTabHttp2, andSendToIntruderis declared asString?(nullable) in Kotlin. This causeskotlinx.serializationto exclude it from the JSON Schema's "required" array, so MCP clients omit the field — but the Burp Montoya API runtime requires it.Result:
Error: Field 'tabName' is required for type with serial name '...', but it was missingRoot cause
JsonSchema.kt line 54 checks
!prop.returnType.isMarkedNullable— only non-nullable fields get added to therequiredarray.String?is nullable, so the schema marks it optional. But the Montoya API'ssendToRepeater(HttpRequest, String)has no null-handling overload.Solution
Change
String?→Stringin all 3 data classes. The Montoya API accepts any non-null String (including empty string), which is semantically equivalent to the original optional behavior.Changes
src/main/kotlin/net/portswigger/mcp/tools/Tools.kt./gradlew embedProxyJar→ BUILD SUCCESSFULNotes
This is intentionally minimal. An alternative would be
String = ""with a conditional to call the 1-param overload when empty, but that adds unnecessary complexity.