Package org.mcpjava.server.tools
Interface ToolResponse.Builder
- All Superinterfaces:
MetaCarrier.Builder<ToolResponse.Builder>
- Enclosing interface:
ToolResponse
Builder for creating tool responses
-
Method Summary
Modifier and TypeMethodDescriptionaddContent(ContentBlock content) Add some unstructured content to the responseaddTextContent(String textContent) Create a text content block from a string and add it to the responsebuild()Builds the tool responsesetError(boolean isError) Sets whether or not the response represents an errorsetStructuredContent(Object structuredContent) Sets the structured content of the responseMethods inherited from interface org.mcpjava.server.MetaCarrier.Builder
putMetadata, setMetadata
-
Method Details
-
addContent
Add some unstructured content to the response- Parameters:
content- the unstructured content to add- Returns:
- this builder
-
addTextContent
Create a text content block from a string and add it to the response- Parameters:
textContent- the text content to add- Returns:
- this builder
-
setStructuredContent
Sets the structured content of the response- Parameters:
structuredContent- the structured content- Returns:
- this builder
-
setError
Sets whether or not the response represents an error- Parameters:
isError-trueif the response represents an error,falseotherwise- Returns:
- this builder
-
build
ToolResponse build()Builds the tool response- Returns:
- the new tool response
-