mirror of
https://gitea.com/gitea/gitea-mcp.git
synced 2025-08-23 14:23:05 +00:00
Update
This commit is contained in:
15
pkg/to/to.go
Normal file
15
pkg/to/to.go
Normal file
@@ -0,0 +1,15 @@
|
||||
package to
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
|
||||
"github.com/mark3labs/mcp-go/mcp"
|
||||
)
|
||||
|
||||
func TextResult(v any) (*mcp.CallToolResult, error) {
|
||||
result, err := json.Marshal(v)
|
||||
if err != nil {
|
||||
return mcp.NewToolResultError("marshal result error"), err
|
||||
}
|
||||
return mcp.NewToolResultText(string(result)), nil
|
||||
}
|
Reference in New Issue
Block a user