(singleTenant bool)
| 834 | } |
| 835 | |
| 836 | func createEnvironmentCheckpointTool(singleTenant bool) *Tool { |
| 837 | return &Tool{ |
| 838 | Definition: newEnvironmentTool( |
| 839 | envToolOptions{ |
| 840 | name: "environment_checkpoint", |
| 841 | description: "Checkpoints an environment in its current state as a container.", |
| 842 | useCurrentEnvironment: singleTenant, |
| 843 | }, |
| 844 | mcp.WithString("destination", |
| 845 | mcp.Description("Container image destination to checkpoint to (e.g. registry.com/user/image:tag"), |
| 846 | mcp.Required(), |
| 847 | ), |
| 848 | ), |
| 849 | Handler: func(ctx context.Context, request mcp.CallToolRequest) (*mcp.CallToolResult, error) { |
| 850 | _, env, err := openEnvironment(ctx, request) |
| 851 | if err != nil { |
| 852 | return nil, err |
| 853 | } |
| 854 | |
| 855 | destination, err := request.RequireString("destination") |
| 856 | if err != nil { |
| 857 | return nil, err |
| 858 | } |
| 859 | |
| 860 | endpoint, err := env.Checkpoint(ctx, destination) |
| 861 | if err != nil { |
| 862 | return nil, fmt.Errorf("failed to checkpoint environment: %w", err) |
| 863 | } |
| 864 | |
| 865 | return mcp.NewToolResultText(fmt.Sprintf("Checkpoint pushed to %q. You MUST use the full content addressed (@sha256:...) reference in `docker` commands. The entrypoint is set to `sh`, keep that in mind when giving commands to the container.", endpoint)), nil |
| 866 | }, |
| 867 | } |
| 868 | } |
| 869 | |
| 870 | func createEnvironmentAddServiceTool(singleTenant bool) *Tool { |
| 871 | return &Tool{ |
no test coverage detected