1// SPDX-FileCopyrightText: Amolith <amolith@secluded.site>
2//
3// SPDX-License-Identifier: AGPL-3.0-or-later
4
5package mcp
6
7import (
8 "fmt"
9
10 "github.com/mark3labs/mcp-go/mcp"
11)
12
13// createErrorResult creates a standardized error response for MCP tool calls
14func createErrorResult(message string) *mcp.CallToolResult {
15 return &mcp.CallToolResult{
16 Content: []mcp.Content{
17 mcp.TextContent{
18 Type: "text",
19 Text: message,
20 },
21 },
22 IsError: true,
23 }
24}
25
26// createSuccessResult creates a standardized success response for MCP tool calls
27func createSuccessResult(message string) *mcp.CallToolResult {
28 return &mcp.CallToolResult{
29 Content: []mcp.Content{
30 mcp.TextContent{
31 Type: "text",
32 Text: message,
33 },
34 },
35 }
36}
37
38// formatGoalText formats goal title and description into a consistent display format
39func formatGoalText(title, description string) string {
40 if description == "" {
41 return title
42 }
43 return fmt.Sprintf("%s: %s", title, description)
44}