Skip to content

fix: make tabName non-nullable to match runtime requirement - #110

Open
sfrmattos wants to merge 1 commit into
PortSwigger:mainfrom
sfrmattos:fix/nullable-tabName-schema
Open

fix: make tabName non-nullable to match runtime requirement#110
sfrmattos wants to merge 1 commit into
PortSwigger:mainfrom
sfrmattos:fix/nullable-tabName-schema

Conversation

@sfrmattos

Copy link
Copy Markdown

Fixes #109

Problem

The tabName field in CreateRepeaterTab, CreateRepeaterTabHttp2, and SendToIntruder is declared as String? (nullable) in Kotlin. This causes kotlinx.serialization to 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 missing

Root cause

JsonSchema.kt line 54 checks !prop.returnType.isMarkedNullable — only non-nullable fields get added to the required array. String? is nullable, so the schema marks it optional. But the Montoya API's sendToRepeater(HttpRequest, String) has no null-handling overload.

Solution

Change String?String in 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

  • 3 lines in src/main/kotlin/net/portswigger/mcp/tools/Tools.kt
  • Build verified: ./gradlew embedProxyJar → BUILD SUCCESSFUL
  • JAR tested in Burp Pro — all 3 tools work correctly

Notes

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.

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: tabName field declared as optional in JSON Schema but required at runtime

1 participant