mirror of
https://gitea.com/gitea/gitea-mcp.git
synced 2025-08-24 06:43:05 +00:00
16 lines
297 B
Go
16 lines
297 B
Go
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
|
|
}
|