Some checks failed
Security Scan / security (push) Failing after 25s
- Import paths: forge.lthn.ai/core/go → dappco.re/go/core
- Import paths: forge.lthn.ai/core/go-log → dappco.re/go/core/log
- Import paths: forge.lthn.ai/core/go-io → dappco.re/go/core/io
- RegisterTask → c.Action("name", handler) across all 15 services
- QueryHandler signature: (any, bool, error) → core.Result
- PERFORM(task) → Action.Run(ctx, opts)
- QUERY returns single core.Result (not 3 values)
- All 17 packages build and test clean on v0.8.0-alpha.1
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
28 lines
764 B
Go
28 lines
764 B
Go
// pkg/mcp/tools_lifecycle.go
|
|
package mcp
|
|
|
|
import (
|
|
"context"
|
|
|
|
"forge.lthn.ai/core/gui/pkg/lifecycle"
|
|
"github.com/modelcontextprotocol/go-sdk/mcp"
|
|
)
|
|
|
|
// --- app_quit ---
|
|
|
|
type AppQuitInput struct{}
|
|
type AppQuitOutput struct {
|
|
Success bool `json:"success"`
|
|
}
|
|
|
|
func (s *Subsystem) appQuit(_ context.Context, _ *mcp.CallToolRequest, _ AppQuitInput) (*mcp.CallToolResult, AppQuitOutput, error) {
|
|
// Broadcast the will-terminate action which triggers application shutdown
|
|
_ = s.core.ACTION(lifecycle.ActionWillTerminate{})
|
|
return nil, AppQuitOutput{Success: true}, nil
|
|
}
|
|
|
|
// --- Registration ---
|
|
|
|
func (s *Subsystem) registerLifecycleTools(server *mcp.Server) {
|
|
mcp.AddTool(server, &mcp.Tool{Name: "app_quit", Description: "Quit the application"}, s.appQuit)
|
|
}
|