Documentation
¶
Overview ¶
Package kb talks to kb-query, the Python service that runs Graphiti search against one FalkorDB instance. The MCP server never touches FalkorDB directly; it only calls kb-query for the graphs a request may read.
Index ¶
- type ActivityDay
- type ActivityRequest
- type Client
- func (c *Client) Activity(ctx context.Context, backend string, req ActivityRequest) ([]ActivityDay, error)
- func (c *Client) Graph(ctx context.Context, backend string, req GraphRequest) (Graph, error)
- func (c *Client) Recent(ctx context.Context, backend string, req RecentRequest) ([]Document, error)
- func (c *Client) Search(ctx context.Context, backend string, req SearchRequest) ([]Fact, error)
- func (c *Client) Stats(ctx context.Context, backend, graph string) (Stats, error)
- type Document
- type Fact
- type Graph
- type GraphEdge
- type GraphNode
- type GraphRequest
- type Kind
- type Reader
- type RecentRequest
- type SearchRequest
- type Searcher
- type Stats
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ActivityDay ¶
ActivityDay is how many documents a brain ingested on one UTC day.
type ActivityRequest ¶
ActivityRequest is sent to kb-query's /activity endpoint.
type Client ¶
Client is the HTTP implementation of Reader.
func (*Client) Activity ¶
func (c *Client) Activity(ctx context.Context, backend string, req ActivityRequest) ([]ActivityDay, error)
Activity calls POST {backend}/activity.
type Document ¶
type Document struct {
Brain string `json:"brain"`
Kind Kind `json:"kind"`
Source string `json:"source"`
CommittedAt *time.Time `json:"committed_at,omitempty"`
}
Document is one ingested file, as listed by /recent.
type Fact ¶
type Fact struct {
Brain string `json:"brain"`
Kind Kind `json:"kind"`
Fact string `json:"fact"`
Source string `json:"source,omitempty"`
ValidAt *time.Time `json:"valid_at,omitempty"`
InvalidAt *time.Time `json:"invalid_at,omitempty"`
Score float64 `json:"score"`
}
Fact is one retrieved Graphiti edge, flattened for packing.
type GraphEdge ¶
type GraphEdge struct {
ID string `json:"id"`
From string `json:"from"`
To string `json:"to"`
Name string `json:"name"`
Fact string `json:"fact"`
Kind Kind `json:"kind"`
Source string `json:"source,omitempty"`
ValidAt *time.Time `json:"valid_at,omitempty"`
InvalidAt *time.Time `json:"invalid_at,omitempty"`
}
GraphEdge is one fact linking two entities of a brain. From and To are node ids.
type GraphNode ¶
type GraphNode struct {
ID string `json:"id"`
Name string `json:"name"`
Summary string `json:"summary"`
Labels []string `json:"labels"`
}
GraphNode is one entity of a brain, as drawn by /graph.
type GraphRequest ¶
type GraphRequest struct {
Graph string `json:"graph"`
Query string `json:"query,omitempty"`
Node string `json:"node,omitempty"`
Limit int `json:"limit"`
}
GraphRequest is sent to kb-query's /graph endpoint: exactly one of Query and Node.
type Reader ¶
type Reader interface {
Searcher
Stats(ctx context.Context, backend, graph string) (Stats, error)
Recent(ctx context.Context, backend string, req RecentRequest) ([]Document, error)
Activity(ctx context.Context, backend string, req ActivityRequest) ([]ActivityDay, error)
Graph(ctx context.Context, backend string, req GraphRequest) (Graph, error)
}
Reader is everything the MCP server asks of kb-query; the HTTP client implements it and tests use a fake.
type RecentRequest ¶
type RecentRequest struct {
Graph string `json:"graph"`
Since *time.Time `json:"since,omitempty"`
Limit int `json:"limit"`
}
RecentRequest is sent to kb-query's /recent endpoint.
type SearchRequest ¶
type SearchRequest struct {
Graph string `json:"graph"`
Query string `json:"query"`
Limit int `json:"limit"`
// Kinds optionally restricts results, e.g. only decisions.
Kinds []Kind `json:"kinds,omitempty"`
}
SearchRequest is sent to kb-query's /search endpoint.