MCPcopy Create free account
hub / github.com/dagger/container-use / createEnvironmentUpdateMetadataTool

Function createEnvironmentUpdateMetadataTool

mcpserver/tools.go:365–399  ·  view source on GitHub ↗
(singleTenant bool)

Source from the content-addressed store, hash-verified

363}
364
365func createEnvironmentUpdateMetadataTool(singleTenant bool) *Tool {
366 return &Tool{
367 Definition: newEnvironmentTool(
368 envToolOptions{
369 name: "environment_update_metadata",
370 description: "Update environment metadata such as title. This updates the descriptive information about what work is being done in the environment.",
371 useCurrentEnvironment: singleTenant,
372 },
373 mcp.WithString("title",
374 mcp.Description("Updated title describing the work being done in this environment."),
375 ),
376 ),
377 Handler: func(ctx context.Context, request mcp.CallToolRequest) (*mcp.CallToolResult, error) {
378 repo, env, err := openEnvironment(ctx, request)
379 if err != nil {
380 return nil, err
381 }
382
383 // Update title if provided
384 if title := request.GetString("title", ""); title != "" {
385 env.State.Title = title
386 }
387
388 if err := repo.Update(ctx, env, request.GetString("explanation", "")); err != nil {
389 return nil, fmt.Errorf("unable to update the environment: %w", err)
390 }
391
392 out, err := marshalEnvironment(env)
393 if err != nil {
394 return nil, fmt.Errorf("failed to marshal environment: %w", err)
395 }
396 return mcp.NewToolResultText(fmt.Sprintf("Environment metadata updated successfully.\n%s", out)), nil
397 },
398 }
399}
400
401func createEnvironmentConfigTool(singleTenant bool) *Tool {
402 return &Tool{

Callers 1

createToolsFunction · 0.85

Calls 4

newEnvironmentToolFunction · 0.85
openEnvironmentFunction · 0.85
marshalEnvironmentFunction · 0.85
UpdateMethod · 0.45

Tested by

no test coverage detected