File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -98,25 +98,18 @@ String setContainer(ToolContext context, @ToolParam(description = "Container pat
9898 {
9999 final String message ;
100100
101- if (StringUtils .isBlank (containerPath ))
101+ Container container = ContainerManager .getForPath (containerPath );
102+
103+ // Must exist and user must have read permission to set a container. Note: Send the same message in either
104+ // case to prevent information exposure.
105+ if (container == null || !container .hasPermission (getUser (context ), ReadPermission .class ))
102106 {
103- message = "Container path was missing. Please provide a valid containerPath parameter . Try using the listContainers tool to see them ." ;
107+ message = "That's not a valid container path . Try using listContainers to see the valid options ." ;
104108 }
105109 else
106110 {
107- Container container = ContainerManager .getForPath (containerPath );
108-
109- // Must exist and user must have read permission to set a container. Note: Send the same message in both
110- // cases to prevent information exposure.
111- if (container == null || !container .hasPermission (getUser (context ), ReadPermission .class ))
112- {
113- message = "That's not a valid container path. Try using listContainers to see the valid options." ;
114- }
115- else
116- {
117- McpService .get ().saveSessionContainer (context , container );
118- message = "Container has been set to " + container .getPath ();
119- }
111+ McpService .get ().saveSessionContainer (context , container );
112+ message = "Container has been set to " + container .getPath ();
120113 }
121114
122115 return message ;
You can’t perform that action at this time.
0 commit comments