Documentation
¶
Overview ¶
Package out builds JSON-RPC response structs for success, error, and tool result payloads.
Index ¶
- func Call(id json.RawMessage, fn func() (string, error)) *proto.Response
- func ErrResponse(id json.RawMessage, code int, msg string) *proto.Response
- func OkResponse(id json.RawMessage, result interface{}) *proto.Response
- func ToolError(id json.RawMessage, msg string) *proto.Response
- func ToolOK(id json.RawMessage, text string) *proto.Response
- func ToolResult(id json.RawMessage, text string, err error) *proto.Response
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Call ¶
Call invokes a no-arg handler and wraps the result.
Parameters:
- id: JSON-RPC request ID
- fn: handler function returning (string, error)
Returns:
- *proto.Response: wrapped handler result
func ErrResponse ¶
ErrResponse builds a JSON-RPC error response.
Parameters:
- id: request ID to echo back
- code: JSON-RPC error code
- msg: human-readable error message
Returns:
- *proto.Response: error response
func OkResponse ¶
func OkResponse(id json.RawMessage, result interface{}) *proto.Response
OkResponse builds a successful JSON-RPC response.
Parameters:
- id: request ID to echo back
- result: response payload
Returns:
- *proto.Response: success response
func ToolError ¶
func ToolError(id json.RawMessage, msg string) *proto.Response
ToolError builds a tool error result.
Parameters:
- id: JSON-RPC request ID
- msg: error message text
Returns:
- *proto.Response: tool result with IsError set
func ToolOK ¶
func ToolOK(id json.RawMessage, text string) *proto.Response
ToolOK builds a successful tool result with text content.
Parameters:
- id: JSON-RPC request ID
- text: success text to include in the result
Returns:
- *proto.Response: tool result with text content
func ToolResult ¶
ToolResult wraps a handler (string, error) return into a proto.Response.
Parameters:
- id: JSON-RPC request ID
- text: success text from the handler
- err: handler error, nil on success
Returns:
- *proto.Response: tool OK or tool error response
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.