Skip to content

Commit cd14092

Browse files
Merge pull request #187 from uuclove1992/main
tool outputSchema
2 parents 4fbf9c5 + ab4a007 commit cd14092

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

protocol/tools.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,9 @@ type Tool struct {
4949
// InputSchema defines the expected parameters for the tool using JSON Schema
5050
InputSchema InputSchema `json:"inputSchema"`
5151

52+
// OutputSchema defines expected output structure for the tool using Optional JSON Schema
53+
OutputSchema OutputSchema `json:"outputSchema"`
54+
5255
// Annotations provides additional hints about the tool's behavior
5356
Annotations *ToolAnnotations `json:"annotations,omitempty"`
5457

@@ -82,6 +85,10 @@ func (t *Tool) MarshalJSON() ([]byte, error) {
8285
m["inputSchema"] = t.InputSchema
8386
}
8487

88+
if t.OutputSchema.Properties != nil {
89+
m["outputSchema"] = t.OutputSchema
90+
}
91+
8592
// Add annotations if present
8693
if t.Annotations != nil {
8794
m["annotations"] = t.Annotations
@@ -101,6 +108,9 @@ type InputSchema struct {
101108
Required []string `json:"required,omitempty"`
102109
}
103110

111+
// OutputSchema represents a Optional JSON Schema object defining expected output structure for a tool
112+
type OutputSchema InputSchema
113+
104114
// CallToolRequest represents a request to call a specific tool
105115
type CallToolRequest struct {
106116
Meta map[string]interface{} `json:"_meta,omitempty"`

0 commit comments

Comments
 (0)