Skip to content

Conversation

ttmunyunguma
Copy link
Contributor

@ttmunyunguma ttmunyunguma commented Sep 15, 2025

@ttmunyunguma ttmunyunguma changed the base branch from integration to feature-mcp-server September 15, 2025 09:23
@ttmunyunguma ttmunyunguma changed the title Feature mcp server 32827 Report an error if ToolArg.name is not set #32827 Sep 15, 2025
@ttmunyunguma ttmunyunguma force-pushed the feature-mcp-server-32827 branch from 34d4eae to daf8d2a Compare September 15, 2025 13:42
@ttmunyunguma ttmunyunguma force-pushed the feature-mcp-server-32827 branch from d7a846d to a398d16 Compare September 17, 2025 10:35
ttmunyunguma and others added 8 commits September 17, 2025 17:22
- Main source needs to depend on the no parameters source set
- No parameters source set needs to define its own dependencies,
  separately from BND, since the bnd build has to depend on it.
- Since we need to depend on jakarta APIs, we need the jakarta project
  to export individual configurations for the dependencies we need so we
  can reference them from gradle.
@ttmunyunguma ttmunyunguma force-pushed the feature-mcp-server-32827 branch from ebc19e8 to f9f39d7 Compare September 23, 2025 09:28
Comment on lines 19 to 20
@Tool(name = "illegalToolArgNameTool", title = "illegal ToolArgName Tool", description = "thows illegalArgumentExeption because of the ToolArgName")
public String illegalToolArgNameTool(@ToolArg(name = Tool.ELEMENT_NAME, description = "input to echo") String input) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What we're testing here is a missing name rather than an "illegal" name.

We should define the argument like this:

@ToolArg(description = "input to echo") String input

We should rename the test.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, thanks

Comment on lines 42 to 44
String expectedErrorHeader = "Illegal arguments found in MCP Tool:";
List<String> expectedErrorList = List.of("io.openliberty.mcp.internal.fat.noparamtool.NoParamTools.illegalToolArgNameTool");
ExpectedAppFailureValidator.findAndAssertExpectedErrorsInLogs("Illegal Tool Arg: ", expectedErrorHeader, expectedErrorList, server);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This message isn't descriptive enough to tell the user what the problem is and what they need to do.

The problem is that a name was not provided for the parameter.

The solution is to either add a name to the @ToolArg annotation, or to add the -parameters compiler option to use the parameter name.

We don't have a name for the parameter, but we do know what position it's in so we can tell the user that.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the message now

E CWWKZ0002E: An exception occurred while starting the application ExpectedNoParamNameFailureTest. The exception message was: com.ibm.ws.container.service.state.StateChangeException: org.jboss.weld.exceptions.DeploymentException: Missing arguments found in MCP Tool: Tool: class io.openliberty.mcp.internal.fat.noparamtool.NoParamTools.missingToolArgNameTool Tool argument name was not provided for the parameter. Either add a name to the @ToolArg annotation, or to add the -parameters compiler option to use the parameter name

@Azquelt
Copy link
Member

Azquelt commented Sep 23, 2025

Could you squash the commits before merging please?

…y, review comments

review comment to make names consistent
Co-authored-by: Andrew Rouse <[email protected]>
@ttmunyunguma ttmunyunguma force-pushed the feature-mcp-server-32827 branch from 44e490b to 7ad2d1e Compare September 24, 2025 08:20
@ttmunyunguma ttmunyunguma merged commit eca8578 into OpenLiberty:feature-mcp-server Sep 24, 2025
@ttmunyunguma ttmunyunguma deleted the feature-mcp-server-32827 branch September 24, 2025 08:22
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.

Report an error if ToolArg.name is not set and the parameter name is not included in the class
2 participants