mcp

package
v0.13.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 13, 2026 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Overview

Package mcp is fuse's stdio MCP server — the agent-facing surface. Agents get four token-disciplined tools (merge_check, preview, resolve, impact); git keeps the merge-driver CLI, CI keeps the GitHub Action, humans keep the CLI. Results are summary-first and compact: a merge check answers with a verdict and counts, attaching per-file detail only where conflicts actually exist.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ToolSchemas

func ToolSchemas() []map[string]any

ToolSchemas returns the four fuse tools. Descriptions are deliberately terse: these ride in every agent's context window for the whole session.

Types

type BreakingItem

type BreakingItem struct {
	File     string `json:"file"`
	Symbol   string `json:"symbol"`
	Kind     string `json:"kind"`
	Severity string `json:"severity"`
}

BreakingItem is one breaking change a clean auto-merge would introduce.

type ConflictItem

type ConflictItem struct {
	File       string  `json:"file"`
	Strategy   string  `json:"strategy"`
	Type       string  `json:"type"`
	Severity   string  `json:"severity"`
	Confidence float64 `json:"confidence"`
}

ConflictItem is one file that would not merge cleanly.

type Handler

type Handler struct {
	Root  string
	Grove analysis.GroveLike // nil when Grove is unavailable; tools degrade
	Merge *merge.IntelliMerge
}

Handler holds the backend state shared by the fuse_* tools.

func NewHandler

func NewHandler(root string, groveClient analysis.GroveLike) *Handler

NewHandler constructs a handler rooted at root.

func (*Handler) Invoke

func (h *Handler) Invoke(name string, args map[string]any) (any, error)

Invoke dispatches one tool call.

type ImpactNode

type ImpactNode struct {
	ID   string `json:"id"`
	File string `json:"file"`
	Name string `json:"name"`
}

ImpactNode is one blast-radius entry.

type ImpactResult

type ImpactResult struct {
	Query string       `json:"query"`
	Count int          `json:"count"`
	Nodes []ImpactNode `json:"nodes,omitempty"`
	Note  string       `json:"note,omitempty"`
}

ImpactResult is the fuse_impact response.

type MergeCheckResult

type MergeCheckResult struct {
	Verdict          string         `json:"verdict"` // clean | conflicts | error detail in message
	Ref              string         `json:"ref"`
	MergeBase        string         `json:"mergeBase"`
	OverlappingFiles int            `json:"overlappingFiles"`
	AutoMergeable    int            `json:"autoMergeable"`
	ConflictCount    int            `json:"conflictCount"`
	Conflicts        []ConflictItem `json:"conflicts,omitempty"`
	BreakingCount    int            `json:"breakingCount"`
	Breaking         []BreakingItem `json:"breaking,omitempty"`
	Note             string         `json:"note,omitempty"`
}

MergeCheckResult is the fuse_merge_check response. Verdict first; lists only where something needs attention.

type PreviewResult

type PreviewResult struct {
	Merged      string  `json:"merged"`
	HasConflict bool    `json:"hasConflict"`
	Strategy    string  `json:"strategy"`
	Confidence  float64 `json:"confidence"`
}

PreviewResult is the fuse_preview response: the merged content is the payload the caller asked for; everything else is one line of metadata.

type ResolveResult

type ResolveResult struct {
	File      string `json:"file"`
	Prompt    string `json:"prompt,omitempty"`
	Validated bool   `json:"validated"`
	Applied   bool   `json:"applied"`
}

ResolveResult is the fuse_resolve response.

type Server

type Server struct {
	// contains filtered or unexported fields
}

Server is the JSON-RPC 2.0 stdio server.

func NewServer

func NewServer(h *Handler) *Server

NewServer wires a Handler into a stdio JSON-RPC server.

func (*Server) Serve

func (s *Server) Serve(r io.Reader, w io.Writer) error

Serve reads framed JSON-RPC messages from r and writes responses to w.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL