(text string, err error)
| 481 | } |
| 482 | |
| 483 | func (t *MCPTool) largeTextArtifactFallback(text string, err error) *ToolResult { |
| 484 | size := utf8.RuneCountInString(text) |
| 485 | logger.WarnCF("tool", "Failed to persist large MCP text artifact", map[string]any{ |
| 486 | "server": t.serverName, |
| 487 | "tool": t.tool.Name, |
| 488 | "chars": size, |
| 489 | "error": err.Error(), |
| 490 | }) |
| 491 | return &ToolResult{ |
| 492 | ForLLM: fmt.Sprintf( |
| 493 | "[MCP returned a large text result (%d chars); omitted from model context because artifact persistence failed.]", |
| 494 | size, |
| 495 | ), |
| 496 | } |
| 497 | } |
| 498 | |
| 499 | func (t *MCPTool) storeEmbeddedResource(ctx context.Context, content *mcp.EmbeddedResource) (string, string, string) { |
| 500 | if content == nil || content.Resource == nil { |
no test coverage detected