We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/patrickdappollonio/mcp-domaintools'
If you have feedback or need assistance with the MCP directory API, please join our Discord server
response.go•481 B
package response
import (
"encoding/json"
"fmt"
"github.com/mark3labs/mcp-go/mcp"
)
// JSON encodes the provided data to JSON and wraps it in an MCP tool result.
// It returns the tool result and any error encountered during JSON marshaling.
func JSON(data interface{}) (*mcp.CallToolResult, error) {
jsonBytes, err := json.Marshal(data)
if err != nil {
return nil, fmt.Errorf("error generating JSON: %w", err)
}
return mcp.NewToolResultText(string(jsonBytes)), nil
}