MCPcopy Create free account
hub / github.com/coder/coder / TestConvertResult

Function TestConvertResult

agent/x/agentmcp/manager_internal_test.go:87–208  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

85}
86
87func TestConvertResult(t *testing.T) {
88 t.Parallel()
89
90 tests := []struct {
91 name string
92 // input is a pointer so we can test nil.
93 input *mcp.CallToolResult
94 want workspacesdk.CallMCPToolResponse
95 }{
96 {
97 name: "NilInput",
98 input: nil,
99 want: workspacesdk.CallMCPToolResponse{},
100 },
101 {
102 name: "TextContent",
103 input: &mcp.CallToolResult{
104 Content: []mcp.Content{
105 mcp.TextContent{Type: "text", Text: "hello"},
106 },
107 },
108 want: workspacesdk.CallMCPToolResponse{
109 Content: []workspacesdk.MCPToolContent{
110 {Type: "text", Text: "hello"},
111 },
112 },
113 },
114 {
115 name: "ImageContent",
116 input: &mcp.CallToolResult{
117 Content: []mcp.Content{
118 mcp.ImageContent{
119 Type: "image",
120 Data: "base64data",
121 MIMEType: "image/png",
122 },
123 },
124 },
125 want: workspacesdk.CallMCPToolResponse{
126 Content: []workspacesdk.MCPToolContent{
127 {Type: "image", Data: "base64data", MediaType: "image/png"},
128 },
129 },
130 },
131 {
132 name: "AudioContent",
133 input: &mcp.CallToolResult{
134 Content: []mcp.Content{
135 mcp.AudioContent{
136 Type: "audio",
137 Data: "base64audio",
138 MIMEType: "audio/mp3",
139 },
140 },
141 },
142 want: workspacesdk.CallMCPToolResponse{
143 Content: []workspacesdk.MCPToolContent{
144 {Type: "audio", Data: "base64audio", MediaType: "audio/mp3"},

Callers

nothing calls this directly

Calls 3

convertResultFunction · 0.85
RunMethod · 0.65
EqualMethod · 0.45

Tested by

no test coverage detected