Skip to content

feat: prune bound parameters from exposed tool definition#70

Open
stenalpjolly wants to merge 2 commits into
googleapis:mainfrom
stenalpjolly:stenalpjolly_issue-20-parameter-pruning
Open

feat: prune bound parameters from exposed tool definition#70
stenalpjolly wants to merge 2 commits into
googleapis:mainfrom
stenalpjolly:stenalpjolly_issue-20-parameter-pruning

Conversation

@stenalpjolly

Copy link
Copy Markdown
Contributor

Summary

This PR implements bound parameter pruning from the exposed tool definition. When parameters are bound to a value or a dynamic supplier, they are resolved by the client, so they are removed from the exposed ToolDefinition that is returned to the user or LLM.

Expectation & Implementation

  • Refactored the Tool class to be immutable, making all configurations return a new Tool instance with the updated state.
  • Inside bindParam, we clone the current ToolDefinition and filter out the bound parameter name from the parameter list.
  • Adjusted tool loading loops in McpToolboxClientImpl to support the new immutable Tool pattern.
  • Updated example and demo controllers (ExampleUsage.java and CymbalTransitController.java) to chain or capture the return values of bindParam calls.

Test cases

  • Run the JUnit test suite to verify everything compiles and passes:
    mvn test -Dtest="*Test,!*E2ETest" -Dnet.bytebuddy.experimental=true
  • Verification of new JUnit test testBoundParameterPruning confirming that:
    • Statically and dynamically bound parameters are correctly pruned from the exposed tool definition list.
    • The client execution still correctly receives the bound parameter values.
    • Verification with null parameter definitions behaves correctly without throwing exceptions.

Acceptance criteria

  • Line coverage for Tool.java and McpToolboxClientImpl.java remains at 100.00%.
  • Checked and passed Checkstyle build check with 0 violations.

Breaking changes

None.

@stenalpjolly stenalpjolly requested a review from a team as a code owner June 24, 2026 08:34
@stenalpjolly stenalpjolly force-pushed the stenalpjolly_issue-20-parameter-pruning branch 2 times, most recently from 85c981f to 0fd1494 Compare June 24, 2026 08:41
@dishaprakash dishaprakash reopened this Jun 24, 2026
@dishaprakash dishaprakash reopened this Jun 24, 2026
@stenalpjolly stenalpjolly force-pushed the stenalpjolly_issue-20-parameter-pruning branch from 2f1948b to c9b8ef7 Compare June 25, 2026 11:46
TAG=agy

CONV=263b1b15-a345-462a-b572-a4183d1426f9
@stenalpjolly stenalpjolly force-pushed the stenalpjolly_issue-20-parameter-pruning branch from c9b8ef7 to 9fa103c Compare June 25, 2026 14:59
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.

2 participants