Help us shape the future of Go! Take the 2026 Go Developer Survey

orbit

package
v3.4.0 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package orbit implements MCP tools for the GitLab Orbit Knowledge Graph on GitLab.com.

Six read-only handlers are exposed as individual tools (gitlab_orbit_*) and a consolidated meta-tool (gitlab_orbit). GitLab.com removed five of the six REST routes they read on 2026-10-27 and -28 (gitlab-org/gitlab!265633, !264745, !265998 and !266009), so each now reads the source GitLab offers in their place, a documented API where there is one:

  • Status: GraphQL Query.orbit.serviceStatus (service health)
  • Schema: GraphQL Query.orbit.schema (graph schema), and the get_graph_schema command of POST /api/v4/orbit/mcp for its llm text
  • Tools: tools/list of POST /api/v4/orbit/mcp (MCP tool list)
  • DSL: list_commands of POST /api/v4/orbit/mcp (query language, GQL)
  • Query: POST /api/v4/orbit/query (read-only graph query)
  • GraphStatus: GraphQL Group.orbit and Project.orbit (indexing status)

The Orbit MCP endpoint is used only for what GitLab offers nowhere else: the tool list, the command catalog that describes the query language, and the schema as compact text. client-go's Orbit service still sends the removed routes for all but the query, which is why only Query calls it; each of its methods that does is a row of docs/development/upstream-bugs.md.

Since Orbit's general availability on 2026-10-29, GitLab.com serves a namespace's index and its queries only for a top-level group with the orbit_promo add-on or a running Orbit trial. GitLab answers what it does not serve the token with 403 or with null, and the handlers report either as an error naming what Orbit needs (ErrOrbitUnavailable for null). The one exception is a top-level group's index asked by an Owner: GitLab answers its Orbit access and trial beside the null index, and GraphStatus publishes them, since they are the reason (GraphStatusAccess.Serves).

Reference: https://docs.gitlab.com/api/orbit/

The Query handler forwards a query as the caller wrote it, checking only that one was given. GQL, the read-only openCypher 9 based language, is what GitLab.com compiles every query in since it turned orbit_gql_queries on for everyone on 2026-10-15, and DSL describes it from the query_graph command GitLab.com publishes; the route that served the JSON query DSL before, GET /api/v4/orbit/schema/dsl, answers 404 since then, and nothing here asks it (issue 1414). gitlab-org/gitlab!261947 removed the flag and the JSON DSL with it on 2026-10-27, and GitLab's query route takes the query as text, so the handler takes text alone; a JSON query written as text is answered with a hint that GitLab.com reads GQL. The language keeps changing: GitLab compiles each query and refuses what it cannot run with a message naming the fault, which reaches the caller rather than being replaced by rules written here, which went stale once already (issue 1031).

Index

Constants

View Source
const (
	AccessLicensed    = "LICENSED"
	AccessTrialActive = "TRIAL_ACTIVE"
)

The two Orbit access states under which GitLab.com serves a namespace's index and its queries, GitLab's OrbitAccessState: a group with Orbit access (from its plan, the Orbit promo add-on or the free beta, which reason names) and a group whose Orbit trial is running. Under every other state (UNLICENSED, NOT_CONFIGURED, TRIAL_ELIGIBLE, TRIAL_ENDED, TRIAL_NOT_ELIGIBLE and TRIAL_STATUS_UNAVAILABLE) the group has no access GitLab.com serves an index under, but the state does not decide the index on its own: GitLab reads the state from the add-on and from CustomersDot, and the index from the add-on and the trial GitLab recorded, which it ends up to an hour after CustomersDot does. So a trial CustomersDot could not report (TRIAL_STATUS_UNAVAILABLE), or one that has just ended (TRIAL_ENDED), can still come with its index.

Variables

View Source
var ErrOrbitUnavailable = errors.New("orbit is not available to this token")

ErrOrbitUnavailable is wrapped by every error an Orbit action returns when GitLab answered what it asked with null, which is how GitLab's GraphQL API answers a user or a namespace Orbit is not available to. The record generator reads it to tell GitLab declining the account from a shape the handler could not read.

Functions

func ActionSpecs

func ActionSpecs(client *gitlabclient.Client) []toolutil.ActionSpec

ActionSpecs returns the canonical ActionSpec definitions for all GitLab.com Orbit MCP tools.

Each ActionSpec describes one Orbit action (status, schema, tools, dsl, query, graph_status), answered by GitLab's GraphQL API, its Orbit MCP endpoint or the Orbit query route, and is used to project both individual tools and meta-tool routes in the MCP server runtime.

These specs are the single source of truth for tool registration, schema, and documentation.

func FormatDSLMarkdown

func FormatDSLMarkdown(out DSLOutput) string

FormatDSLMarkdown renders the Orbit query language as the card of one object: the command a query runs as, its grammar and the JSON Schema of its input, each inside a fence sized to it, or the compact text GitLab answers the llm format with as the whole body.

The grammar names no entity, so every shape of the card ends on the action that lists them, and the card says so when GitLab described no query command at all, which is also what a caller is told while the route this action read until issue 1414, GET /orbit/schema/dsl, answers 404.

func FormatGraphStatusMarkdown

func FormatGraphStatusMarkdown(out GraphStatusOutput) string

FormatGraphStatusMarkdown renders Orbit indexing status as the card of one object: whether Orbit is on, the top-level group's Orbit access and trial, how much is indexed, how the last run went, and the per-domain node counts as a nested collection.

Since Orbit's general availability GitLab.com serves a group's index under LICENSED or TRIAL_ACTIVE access, and answers a top-level group with no access it serves an index under with its access and no index. The card then says so in a line of its own ([graphStatusAccessNote]), since a missing index reads as an empty graph to a model that has not read the access row, and its next step leads to the access rather than to a query GitLab would refuse. An index GitLab answered all the same keeps the card of any other index.

func FormatQueryMarkdown

func FormatQueryMarkdown(out QueryOutput) string

FormatQueryMarkdown renders one query result as the card of one object: what was asked and how much came back, then the query text and the rows as fenced bodies.

func FormatSchemaMarkdown

func FormatSchemaMarkdown(out SchemaOutput) string

FormatSchemaMarkdown renders the Knowledge Graph schema as the card of one object: the three type counts, then the domains as a nested collection. The compact text GitLab answers the llm format with is the whole response, so it is rendered as the card's body instead.

Its next steps lead to the query language and then to a query. They used to lead to orbit.tools for "the live query and tool manifest", which is the manifest of the MCP tools Orbit serves (list_commands and invoke_command on GitLab.com, read 2026-10-06) and describes no query: the grammar is what orbit.dsl returns, read from the query_graph command since issue 1414.

The edge types and the nodes GitLab answered expanded are written out too (issue 1311). The card used to stop at the counts and the domains, so the relationship names and the properties a query is built from were in the structured output alone, and a client that hands the model the text, as most do on the default surface, left it to guess them while the last step spoke of "the node and edge types listed here". A schema with nodes and none of them expanded therefore adds a step saying how to ask for their properties.

func FormatStatusMarkdown

func FormatStatusMarkdown(out StatusOutput) string

FormatStatusMarkdown renders the health of the Orbit service as the card of one object: the overall state and version, then the components as a nested collection. A user Orbit is not available to never reaches the card: GitLab answers that user's status with null, which Status reports as an error.

func FormatToolsMarkdown

func FormatToolsMarkdown(out ToolsOutput) string

FormatToolsMarkdown renders the Orbit tool manifest as a table: a collection of objects that share columns.

The name goes in a code span through the cell form of the span writer. It used to be stripped of every backtick it held and then run through the cell escaper inside a hand-written span, which showed "|" as those five characters and quietly deleted part of the name.

The tools listed are Orbit's own, which a query sent through orbit.query does not use, so the next steps lead to the grammar and the names a query is built from rather than to the parameters these tools declare.

Types

type DSLInput

type DSLInput struct {
	ResponseFormatInput
}

DSLInput holds parameters for retrieving the Orbit query language.

type DSLOutput

type DSLOutput struct {
	toolutil.HintableOutput
	// ResponseFormat echoes the response_format that was asked for ("raw" for
	// the command as a JSON object, "llm" for it as compact text), or nothing
	// when the caller chose none and the handler asked for raw.
	ResponseFormat string `json:"response_format,omitempty"`
	// FormattedText is the command as compact text, which is the whole of
	// GitLab's answer when the caller selected the "llm" response format.
	FormattedText string `json:"formatted_text,omitempty"`
	// Name is the name of the Orbit command a query runs as, query_graph,
	// under the key GitLab sends it with.
	Name string `json:"name,omitempty"`
	// Description is the grammar of the query language as the command
	// describes it.
	Description string `json:"description,omitempty"`
	// Parameters is the decoded JSON Schema of the command's input, whose
	// query property is the query text orbit.query sends.
	Parameters any `json:"parameters,omitempty"`
}

DSLOutput is the query language GitLab.com compiles orbit.query in, as the Orbit command a graph query runs as describes it.

GitLab.com reads every query as GQL since it turned orbit_gql_queries on for everyone at 01:06 UTC on 2026-10-15 (issue 1414). What it publishes for GQL is the query_graph command of the Orbit command catalog: a description of the grammar and the JSON Schema of the command's input. The catalog was served at GET /api/v4/orbit/agent/commands until gitlab-org/gitlab!266009 removed the route on 2026-10-28; it is now the list_commands tool of the Orbit MCP endpoint, POST /api/v4/orbit/mcp, which answers the same list.

func DSL

func DSL(ctx context.Context, client *gitlabclient.Client, input DSLInput) (DSLOutput, error)

DSL retrieves the query language GitLab.com compiles orbit.query in, as the query_graph command describes it.

Source: the list_commands tool of GitLab's Orbit MCP endpoint, called with command_names [query_graph], which replaced GET /api/v4/orbit/agent/commands when gitlab-org/gitlab!266009 removed the route on 2026-10-28. With format raw the tool answers the same list of commands the route did, and the query_graph entry gives the grammar's description and the JSON Schema of the command's input; with llm it answers the command as compact text. The tool defaults to llm and the route defaulted to raw, so raw is sent when the caller chose none, which keeps the answer this action has always given.

type GraphStatusAccess added in v3.4.0

type GraphStatusAccess struct {
	// State is the group's access state, GitLab's OrbitAccessState: LICENSED,
	// TRIAL_ACTIVE, TRIAL_ELIGIBLE, TRIAL_ENDED, TRIAL_NOT_ELIGIBLE,
	// TRIAL_STATUS_UNAVAILABLE, UNLICENSED or NOT_CONFIGURED.
	State string `json:"state"`
	// Reason is the cause of a state that has more than one, GitLab's
	// OrbitAccessReason: where the access of a LICENSED group comes from
	// (PLAN, PROMO_ADD_ON or BETA), or why a group has none (FREE_PLAN,
	// NO_LICENSE, NO_ACCESS, TRIAL_EXPIRED or CREDITS_EXHAUSTED). Absent when
	// the state has one cause, for which GitLab sends null.
	Reason string `json:"reason,omitempty"`
	// TurnOnDenialReason is why the token's user cannot turn Orbit on for the
	// group, GitLab's OrbitTurnOnDenialReason: FORBIDDEN, TRIAL_REQUIRED,
	// PURCHASE_REQUIRED, TRIAL_ENDED or UNAVAILABLE. Absent when turning Orbit
	// on is allowed or it is already on.
	TurnOnDenialReason string `json:"turn_on_denial_reason,omitempty"`
}

GraphStatusAccess is the Orbit access state of a top-level group, GitLab's OrbitAccess. The values are GitLab's enums as it spells them.

func (*GraphStatusAccess) Serves added in v3.4.0

func (a *GraphStatusAccess) Serves() bool

Serves reports whether this is an access state GitLab.com serves the group's index and its queries under: LICENSED or TRIAL_ACTIVE. A missing index under any other state is the access, not the graph; the index can still come under one of them for a while, as the constants above say.

type GraphStatusArea added in v3.4.0

type GraphStatusArea struct {
	// Name is the area (e.g. "source_code").
	Name string `json:"name,omitempty"`
	// State is the area's indexing state.
	State string `json:"state,omitempty"`
}

GraphStatusArea is the indexing state of one area of the graph.

type GraphStatusDomain

type GraphStatusDomain struct {
	// Name is the domain (e.g. "code_review").
	Name string `json:"name,omitempty"`
	// Items are the counts of each entity in the domain.
	Items []GraphStatusDomainItem `json:"items,omitempty"`
}

GraphStatusDomain is the number of indexed items in one domain.

type GraphStatusDomainItem

type GraphStatusDomainItem struct {
	// Name is the entity (e.g. "MergeRequest").
	Name string `json:"name,omitempty"`
	// Count is the number of indexed items of the entity.
	Count int64 `json:"count"`
}

GraphStatusDomainItem is the number of indexed items of one entity.

type GraphStatusIndexing

type GraphStatusIndexing struct {
	// State is the indexing state: READY, INDEXING, NOT_STARTED, FAILED or
	// UNKNOWN.
	State string `json:"state,omitempty"`
	// LastCompletedAt is when Orbit last completed indexing the group or
	// project, empty until the first run completes.
	LastCompletedAt string `json:"last_completed_at,omitempty"`
	// Areas are the indexing states of each area.
	Areas []GraphStatusArea `json:"areas,omitempty"`
}

GraphStatusIndexing describes the indexing state of the group or project.

type GraphStatusInput

type GraphStatusInput struct {
	// NamespaceID targets a group by ID. Mutually exclusive with ProjectID
	// and FullPath; exactly one of the three must be set.
	NamespaceID int64 `json:"namespace_id,omitempty" jsonschema:"Group ID to inspect. Set exactly one of namespace_id, project_id, or full_path."`
	// ProjectID targets a project by ID. Mutually exclusive with
	// NamespaceID and FullPath; exactly one of the three must be set.
	ProjectID int64 `json:"project_id,omitempty" jsonschema:"Project ID to inspect. Set exactly one of namespace_id, project_id, or full_path."`
	// FullPath targets a group or project by full path
	// (e.g. "gitlab-org/gitlab"). Mutually exclusive with NamespaceID
	// and ProjectID; exactly one of the three must be set.
	FullPath string `` /* 143-byte string literal not displayed */
	StructuredFormatInput
}

GraphStatusInput holds parameters for retrieving Orbit graph indexing status.

type GraphStatusOutput

type GraphStatusOutput struct {
	toolutil.HintableOutput
	// Enabled reports whether Orbit is turned on for the group's top-level
	// group; absent for a project, for which GitLab sends null.
	Enabled *bool `json:"enabled,omitempty"`
	// EnabledAt is when Orbit was turned on for the top-level group.
	EnabledAt string `json:"enabled_at,omitempty"`
	// Access is the Orbit access state of a top-level group, GitLab's
	// OrbitNamespace.access. GitLab answers it for a top-level group alone,
	// and null for a subgroup, a project and a token that cannot read the
	// group's Orbit setting, which takes the Owner role, so it is absent
	// there: the top-level group's full_path reports it to an Owner. An index
	// absent under a state other than LICENSED or TRIAL_ACTIVE is absent
	// because of the access ([GraphStatusAccess.Serves]).
	Access *GraphStatusAccess `json:"access,omitempty"`
	// Trial is the Orbit trial of a top-level group, GitLab's
	// OrbitNamespace.trial: null, and so absent, for a subgroup, a project, a
	// token that cannot read the trial, and when GitLab could not read it
	// from CustomersDot.
	Trial *GraphStatusTrial `json:"trial,omitempty"`
	// Projects is the indexing progress of the projects, GitLab's
	// indexing.projects. It, Domains and Indexing are absent when GitLab
	// serves no index: a group without Orbit access, Orbit turned off, or a
	// token below the Reporter role there.
	Projects *GraphStatusProjects `json:"projects,omitempty"`
	// Domains are the indexed item counts of each domain, GitLab's
	// itemCounts.domains.
	Domains []GraphStatusDomain `json:"domains,omitempty"`
	// Indexing is the indexing state.
	Indexing *GraphStatusIndexing `json:"indexing,omitempty"`
}

GraphStatusOutput is the Orbit indexing status of one group or project, as GitLab's GraphQL API answers Group.orbit and Project.orbit.

It used to be GET /api/v4/orbit/graph_status, which gitlab-org/gitlab!264745 removed on 2026-10-28 (issue 1516). Gone with it: formatted_text (GraphQL has no llm rendering), each count's state, and the last run's start, duration and error. Added: whether Orbit is on for the group and since when, the state of each area, two more project counts, and the Orbit access and trial of a top-level group, which decide since Orbit's general availability on 2026-10-29 whether GitLab.com serves the index at all.

func GraphStatus

func GraphStatus(ctx context.Context, client *gitlabclient.Client, input GraphStatusInput) (GraphStatusOutput, error)

GraphStatus retrieves the Orbit indexing status of one group or project on GitLab.com.

Source: GitLab's GraphQL API, Group.orbit and Project.orbit, which replaced GET /api/v4/orbit/graph_status when gitlab-org/gitlab!264745 removed the route on 2026-10-28 (issue 1516; client-go's Orbit.GetGraphStatus still sends that GET). Exactly one of namespace_id, project_id or full_path is set: a full path is asked as both a group and a project, and an ID as the global ID of the one it names.

GitLab answers indexing and itemCounts null when Orbit is not available to the token there, is off for the top-level group, or the token is below the Reporter role. For a top-level group it answers the group's Orbit access and trial beside them to a token with the Owner role there, which say why, so that answer is published with the index absent rather than refused: since Orbit's general availability a group without access is the common case, and its access state is the answer a caller needs. A subgroup or a project carries no access (GitLab answers it null there, and so for a token below Owner), so an index answered null with nothing beside it is reported as an error naming what Orbit needs and that the top-level group reports its access to an Owner.

func (GraphStatusOutput) HasIndex added in v3.4.0

func (o GraphStatusOutput) HasIndex() bool

HasIndex reports whether GitLab answered any part of the index: the indexing state, the project counts or the item counts.

type GraphStatusProjects

type GraphStatusProjects struct {
	// Indexed is the number of indexed projects.
	Indexed int64 `json:"indexed"`
	// TotalKnown is the number of projects known to Orbit.
	TotalKnown int64 `json:"total_known"`
	// Gaps is the number of projects that are not indexed, as GitLab's
	// gaps field counts them.
	Gaps int64 `json:"gaps"`
	// NotIndexed is the number of projects that are not indexed, as
	// GitLab's notIndexed field counts them.
	NotIndexed int64 `json:"not_indexed"`
	// Total is the number of projects known to Orbit, as GitLab's total
	// field counts them.
	Total int64 `json:"total"`
}

GraphStatusProjects describes the indexing progress of the projects in the group or project (OrbitIndexingProjects).

type GraphStatusTrial added in v3.4.0

type GraphStatusTrial struct {
	// State is the trial's state, GitLab's OrbitTrialState: ELIGIBLE,
	// NOT_ELIGIBLE, ACTIVE or ENDED.
	State string `json:"state"`
	// ExpiresOn is the last day of the trial, in UTC; absent before a trial
	// starts.
	ExpiresOn string `json:"expires_on,omitempty"`
	// Credits are the trial's credits.
	Credits *GraphStatusTrialCredits `json:"credits,omitempty"`
	// Offer is the terms of a new trial, absent unless the token's user can
	// start one and CustomersDot sends valid terms.
	Offer *GraphStatusTrialOffer `json:"offer,omitempty"`
}

GraphStatusTrial is the Orbit trial of a top-level group, GitLab's OrbitTrial, as GitLab reads it from CustomersDot.

type GraphStatusTrialCredits added in v3.4.0

type GraphStatusTrialCredits struct {
	// Remaining is the number of trial credits left.
	Remaining *float64 `json:"remaining,omitempty"`
	// Total is the number of credits granted to the trial.
	Total *float64 `json:"total,omitempty"`
}

GraphStatusTrialCredits are the credits of an Orbit trial, GitLab's OrbitTrialCredits. Each is absent when GitLab sends null, and a remaining count of zero is published, since it is why a trial ended.

type GraphStatusTrialOffer added in v3.4.0

type GraphStatusTrialOffer struct {
	// DurationDays is the number of days a new trial lasts.
	DurationDays *int64 `json:"duration_days,omitempty"`
	// InitialCredits is the number of free credits a new trial starts with.
	InitialCredits *float64 `json:"initial_credits,omitempty"`
}

GraphStatusTrialOffer is the terms of a new Orbit trial, GitLab's OrbitTrialOffer, which GitLab sends only to a user who can start one, and only when CustomersDot sends valid terms.

type QueryInput

type QueryInput struct {
	Query string `` /* 1303-byte string literal not displayed */
	// ResponseFormat selects the answer's shape. POST /orbit/query declares
	// a third value beside raw and llm, which is why this input carries its
	// own field rather than [ResponseFormatInput] (`values: %w[raw llm gql]`
	// in ee/lib/api/orbit/data.rb):
	//   - "raw": the structured envelope, sent when the field is omitted
	//   - "llm": compact text optimized for LLM consumption
	//   - "gql": the result as a graph pattern table, text like llm
	//
	// "json" is read as "raw", for the reason [ResponseFormatInput] gives.
	ResponseFormat string `` /* 189-byte string literal not displayed */
}

QueryInput holds parameters for executing an Orbit Knowledge Graph query.

The Query field is GQL text, the read-only subset of openCypher 9 syntax the Knowledge Graph compiles, which is the language GitLab.com reads every query in since it turned orbit_gql_queries on for everyone at 01:06 UTC on 2026-10-15. DSL describes it from what GitLab.com publishes. This server checks only that a query was given: GitLab compiles it and refuses what it cannot run with a message naming the line and column of the fault, which reaches the caller (toolutil's Workhorse query refusal). Rules written here would only go stale, which is what issue 1031 was.

The query is text and nothing else, as GitLab declares it (`requires :query, type: String` in ee/lib/api/orbit/data.rb). gitlab-org/gitlab!261947, merged on 2026-10-27, removed the orbit_gql_queries flag and the JSON query DSL with it, and GitLab.com has since refused a query sent as a JSON object with 400 {"error":"query is invalid"} before the Knowledge Graph sees it (measured 2026-10-29). This input took an object until then, forwarded so it would work if GitLab.com turned the flag back off (issue 1414); with the flag gone the object is an input GitLab refuses whatever it holds, so it is no longer taken. A JSON query written as text is still sent, since it is text, and [wrapQueryErr] answers GitLab's compile_error for it with an example of GQL.

The statement, as the query_graph command describes it on GitLab.com (read 2026-10-29):

MATCH pattern [WHERE predicates]
[MATCH pattern [WHERE predicates] ...]
RETURN projections
[ORDER BY key [ASC | DESC]]
[SKIP rows] [LIMIT rows]

Every node carries a label where it first appears, and at least one is bounded by its id or a literal property, inline or in WHERE; LIMIT is not a filter. A relationship type follows a colon, -[:IN_PROJECT]->, several types are joined by | (-[:IN_PROJECT|CONTAINS*1..3]->, answered 200 on 2026-10-26), a repeat is bounded (*1..3), and no path is longer than three hops. A traversal can leave the type out, -[*1..3]->, to follow any type, but a shortest path, MATCH path = ANY SHORTEST (a)-[:TYPE*1..3]->(b) RETURN path with both ends bounded, names its relationship types: GitLab.com refuses the wildcard there with "shortest paths require named relationship types" (measured 2026-10-29, issue 1528). WHERE combines predicates on one node's properties with AND and NOT. RETURN selects properties or whole nodes, and count, sum, avg, min and max aggregate, every other item becoming a group key; an aggregate is aliased and sorted by its alias, with one sort key. SKIP takes 0 to 10000 and LIMIT 1 to 1000, which replaced PAGE and AFTER (gitlab-org/orbit/knowledge-graph!2924, issue 1527). CALL db.schema() and CALL db.schema('Node') answer the ontology. The query type of the answer is inferred from the statement.

Examples, each answered 200 by GitLab.com on 2026-10-29:

MATCH (p:Project {full_path: 'jmrp-oss/orbit-fixtures/kg-fixtures'}) RETURN p.id, p.full_path, p.name
MATCH (j:Job)-[:IN_PROJECT]->(p:Project) WHERE p.full_path STARTS WITH 'jmrp-oss/orbit-fixtures/' RETURN p, count(j) AS job_count ORDER BY job_count DESC
MATCH (p:Project {full_path: 'jmrp-oss/orbit-fixtures/kg-fixtures'})--(n) RETURN n

A shortest path over a named relationship type, answered 200 on 2026-10-26:

MATCH path = ANY SHORTEST (mr:MergeRequest {source_branch: 'feature/restock-helper'})-[:IN_PROJECT*1..2]->(p:Project {full_path: 'jmrp-oss/orbit-fixtures/kg-fixtures'}) RETURN path

type QueryOutput

type QueryOutput struct {
	toolutil.HintableOutput
	// FormattedText is the text body returned by the server when the
	// caller selected the "llm" response format, or the graph pattern
	// table of the "gql" one.
	FormattedText string `json:"formatted_text,omitempty"`
	// Result is the decoded result envelope returned for the
	// "raw" response format. Its shape depends on the
	// query_type: traversal returns a list of row objects,
	// aggregation returns aggregation rows, neighbors returns the
	// neighbor expansion, and path_finding returns the matching paths.
	Result any `json:"result,omitempty"`
	// QueryType echoes the query_type that produced this result
	// (traversal, aggregation, neighbors, or path_finding).
	QueryType string `json:"query_type,omitempty"`
	// RawQueryStrings are the SQL strings the server executed for
	// the request; useful for debugging slow or unexpected queries.
	RawQueryStrings []string `json:"raw_query_strings,omitempty"`
	// RowCount is the number of rows in the result envelope.
	RowCount int64 `json:"row_count,omitempty"`
}

QueryOutput is the result envelope returned by Orbit query execution.

func Query

func Query(ctx context.Context, client *gitlabclient.Client, input QueryInput) (QueryOutput, error)

Query executes a read-only Orbit Knowledge Graph query on GitLab.com.

Endpoint: POST /api/v4/orbit/query, one of the Orbit routes GitLab.com still serves after the GA removals. The query is forwarded as the caller wrote it, once it is known not to be blank: GQL text reaches GitLab as the body's query string, {"query": "<GQL text>"}. See QueryInput for the language. GitLab judges everything else, and a query it refuses comes back as a 400 whose message says what to change, with [wrapQueryErr]'s hint pointing at the two actions that describe the language and the graph.

GitLab infers the query type from the statement and answers it beside the result: traversal, aggregation, neighbors or path_finding.

When response_format is omitted, the handler sends "raw" (structured JSON) explicitly rather than leaving the choice to GitLab's default, which is "raw" today (ee/lib/api/orbit/data.rb) and was not always. Structured JSON is strictly more useful for an MCP tool: the LLM can iterate over result nodes directly, the SDK decodes row_count, and downstream markdown formatters pretty-print the envelope. Callers who want the compact TOON text pass response_format="llm", and the graph pattern table "gql"; both are text GitLab answers whole, which client-go's QueryRaw hands back as it came.

type ResponseFormatInput

type ResponseFormatInput struct {
	// ResponseFormat selects the answer's shape. GitLab declares two values
	// (the format property of list_commands' input schema):
	//   - "raw": structured JSON
	//   - "llm": compact text optimized for LLM consumption
	//
	// "json" is accepted here as a synonym of "raw" and sent as "raw": it was
	// offered here as a value of its own until GitLab's refusal of it was
	// measured on the REST routes this action read before.
	//
	// When empty the handler asks for "raw", the default of the REST route
	// this action read until GitLab.com removed it on 2026-10-28; the MCP tool
	// defaults to llm.
	ResponseFormat string `json:"response_format,omitempty" jsonschema:"Response format: raw or llm (json is read as raw). When omitted, raw."`
}

ResponseFormatInput is the response_format selector of orbit.dsl, the one Orbit action besides orbit.query and orbit.schema whose source still renders an llm text: the list_commands tool of GitLab's Orbit MCP endpoint. The query takes a third value and declares its own field (QueryInput.ResponseFormat).

type SchemaDomain

type SchemaDomain struct {
	// Name is the domain identifier (e.g. "core", "source_code").
	Name string `json:"name,omitempty"`
	// NodeNames are the node kinds in the domain.
	NodeNames []string `json:"node_names,omitempty"`
}

SchemaDomain is one domain of the Orbit graph schema and the node kinds in it, grouped from each node's domain in the order GitLab lists the nodes.

type SchemaEdge

type SchemaEdge struct {
	// Name is the edge kind, which a query uses as the relationship type
	// (e.g. "AUTHORED", "IN_PROJECT").
	Name string `json:"name,omitempty"`
	// Description is the human-readable edge summary.
	Description string `json:"description,omitempty"`
	// Variants are the pairs of node kinds the edge connects, GitLab's
	// endpoints.
	Variants []SchemaEdgeVariant `json:"variants,omitempty"`
}

SchemaEdge describes an Orbit graph edge kind.

type SchemaEdgeVariant

type SchemaEdgeVariant struct {
	// SourceType is the node kind at the start of the edge (e.g. "User").
	SourceType string `json:"source_type,omitempty"`
	// TargetType is the node kind at the end of the edge (e.g. "Issue").
	TargetType string `json:"target_type,omitempty"`
}

SchemaEdgeVariant describes one pair of node kinds an Orbit edge connects.

type SchemaInput

type SchemaInput struct {
	// Expand lists node names whose properties should be included in the
	// response. Without it the schema lists every node kind and edge kind
	// without the properties, which is most of the answer's size.
	Expand []string `` /* 162-byte string literal not displayed */
	// Format selects the schema response shape: "raw" (GitLab's GraphQL
	// schema, the default) or "llm" (the compact text the get_graph_schema
	// command of GitLab's Orbit MCP endpoint answers), with "json" read as
	// "raw". Whichever of the two input names carries it, it means the same.
	Format string `` /* 134-byte string literal not displayed */
	// ResponseFormat is an alias for Format. Must match Format when both are
	// set.
	ResponseFormat string `json:"response_format,omitempty" jsonschema:"Alias for format. Must match format when both are set."`
}

SchemaInput holds parameters for retrieving the Orbit graph schema.

type SchemaNode added in v3.4.0

type SchemaNode struct {
	// Name is the node kind, which a query uses as the node label.
	Name string `json:"name"`
	// Description is the human-readable node summary.
	Description string `json:"description,omitempty"`
	// Domain is the domain the node kind belongs to.
	Domain string `json:"domain,omitempty"`
	// PrimaryKey is the property that identifies a node.
	PrimaryKey string `json:"primary_key,omitempty"`
	// LabelField is the property shown as a node's label, GitLab's
	// labelProperty.
	LabelField string `json:"label_field,omitempty"`
	// Display is how GitLab draws nodes of the kind.
	Display *SchemaNodeDisplay `json:"display,omitempty"`
	// Properties are the node kind's properties, present only for the
	// nodes named in expand.
	Properties []SchemaProperty `json:"properties,omitempty"`
}

SchemaNode is one node kind of the Orbit graph schema.

type SchemaNodeDisplay added in v3.4.0

type SchemaNodeDisplay struct {
	// Color is the hex color of the node kind.
	Color string `json:"color,omitempty"`
	// Size is the relative size of the node kind in a graph.
	Size int64 `json:"size,omitempty"`
}

SchemaNodeDisplay is how GitLab draws nodes of a kind.

type SchemaOutput

type SchemaOutput struct {
	toolutil.HintableOutput
	// FormattedText is the schema as compact text, which is the whole of
	// GitLab's answer when the caller selected the "llm" format.
	FormattedText string `json:"formatted_text,omitempty"`
	// Domains are the domains of the node kinds, each with its nodes.
	Domains []SchemaDomain `json:"domains,omitempty"`
	// Nodes are the node kinds.
	Nodes []SchemaNode `json:"nodes,omitempty"`
	// Edges are the edge kinds.
	Edges []SchemaEdge `json:"edges,omitempty"`
}

SchemaOutput is the Orbit graph schema: GitLab's GraphQL Query.orbit.schema for the structured answer, and the get_graph_schema command of the Orbit MCP endpoint for the llm text.

It used to be GET /api/v4/orbit/schema, which gitlab-org/gitlab!265633 removed on 2026-10-27. Gone with it: schema_version, each domain's description, and each node's incoming_edges and outgoing_edges, which the edges list carries pair by pair. Added: each node's primary key, label property and display hints, typed where the REST answer was passed on undecoded.

func Schema

func Schema(ctx context.Context, client *gitlabclient.Client, input SchemaInput) (SchemaOutput, error)

Schema retrieves the Orbit graph schema (node kinds, edge kinds, and the properties of the node kinds named in expand) from GitLab.com.

Source: GitLab's GraphQL API, Query.orbit.schema, for the structured answer, which replaced GET /api/v4/orbit/schema when gitlab-org/gitlab!265633 removed the route on 2026-10-27 (client-go's Orbit.GetSchema still sends that GET). GraphQL has no compact text rendering, so format=llm is answered by the get_graph_schema command of GitLab's Orbit MCP endpoint ([schemaText]), the one source of it GitLab offers.

expand keeps the meaning it had on the REST route: without it no property is asked for, and with it the properties are asked for and kept on the named nodes alone, matched without regard to case.

type SchemaProperty added in v3.4.0

type SchemaProperty struct {
	// Name is the property name.
	Name string `json:"name"`
	// DataType is the property's data type, for example String or Int.
	DataType string `json:"data_type,omitempty"`
	// Nullable reports whether the property can be empty.
	Nullable bool `json:"nullable"`
	// EnumValues are the values an enum property takes, empty otherwise.
	EnumValues []string `json:"enum_values,omitempty"`
}

SchemaProperty is one property of a node kind: the name a query filters or returns, its type, and the values an enum takes.

type StatusComponent

type StatusComponent struct {
	// Name is the component, for example "clickhouse-graph" or "nats".
	Name string `json:"name,omitempty"`
	// Status is the component's health state, GitLab's
	// OrbitServiceComponent.state: HEALTHY, DEGRADED, UNHEALTHY, MIGRATING
	// or UNKNOWN.
	Status string `json:"status,omitempty"`
}

StatusComponent describes the health of one component of the Orbit service (OrbitServiceComponent in GitLab's GraphQL API).

type StatusInput

type StatusInput struct {
	StructuredFormatInput
}

StatusInput holds parameters for retrieving Orbit service health.

type StatusOutput

type StatusOutput struct {
	toolutil.HintableOutput
	// Status is the overall health state of the Orbit service: HEALTHY,
	// DEGRADED, UNHEALTHY, MIGRATING or UNKNOWN.
	Status string `json:"status,omitempty"`
	// Version is the Orbit service version.
	Version string `json:"version,omitempty"`
	// Components are the health states of the service's components.
	Components []StatusComponent `json:"components,omitempty"`
}

StatusOutput is the health of the Orbit service, as GitLab's GraphQL API answers Query.orbit.serviceStatus.

It used to be GET /api/v4/orbit/status, which gitlab-org/gitlab!265633 removed on 2026-10-27. The fields GraphQL no longer sends are gone from the output: user.available (GitLab answers serviceStatus null to a user Orbit is not available to, which Status reports as an error), the nested system object, timestamp, formatted_text, and each component's replicas and metrics. The status and component status are GraphQL's state, asked under the output's names in the document.

func Status

func Status(ctx context.Context, client *gitlabclient.Client, input StatusInput) (StatusOutput, error)

Status retrieves the health of the Orbit service on GitLab.com.

Source: GitLab's GraphQL API, Query.orbit.serviceStatus, which replaced GET /api/v4/orbit/status when gitlab-org/gitlab!265633 removed the route on 2026-10-27 (client-go's Orbit.GetStatus still sends that GET; register row in docs/development/upstream-bugs.md). GitLab answers serviceStatus null when Orbit is not available on the instance or for the user, which is reported as an error naming what Orbit needs, not as an empty status.

type StructuredFormatInput added in v3.4.0

type StructuredFormatInput struct {
	// ResponseFormat is raw, llm or json, all answered with the structured
	// output. It is checked and not sent: GitLab's GraphQL API has no llm
	// rendering of the Orbit status or of a namespace's index.
	ResponseFormat string `` /* 200-byte string literal not displayed */
}

StructuredFormatInput is the response_format of the two Orbit actions GitLab now answers through GraphQL, orbit.status and orbit.graph_status. GraphQL has one shape, so the parameter is accepted for the callers that send it and changes nothing; a value the REST routes never took is still refused, so a typo is not read as a choice.

type ToolDefinition

type ToolDefinition struct {
	// Name is the tool name as Orbit exposes it.
	Name string `json:"name,omitempty"`
	// Description is the tool's human-readable description.
	Description string `json:"description,omitempty"`
	// Parameters is the decoded JSON Schema for the tool's input, which
	// MCP's tools/list answers as inputSchema.
	Parameters any `json:"parameters,omitempty"`
	// Trusted is the trust flag GitLab sends beside each tool, absent when
	// GitLab sends none.
	Trusted *bool `json:"trusted,omitempty"`
}

ToolDefinition describes one tool GitLab's Orbit MCP endpoint serves.

type ToolsInput

type ToolsInput struct{}

ToolsInput is the input for listing the Orbit MCP tool manifest. The tool list takes no parameters; the type exists so the handler signature is uniform with the other Orbit handlers.

type ToolsOutput

type ToolsOutput struct {
	toolutil.HintableOutput
	// Tools is the list of MCP tools Orbit exposes.
	Tools []ToolDefinition `json:"tools,omitempty"`
}

ToolsOutput is the tool list of GitLab's Orbit MCP endpoint.

func Tools

func Tools(ctx context.Context, client *gitlabclient.Client, _ ToolsInput) (ToolsOutput, error)

Tools retrieves the tools GitLab's Orbit MCP endpoint serves, with the JSON Schema of each tool's input.

Source: tools/list at POST /api/v4/orbit/mcp, which replaced GET /api/v4/orbit/tools when gitlab-org/gitlab!265998 removed the route on 2026-10-28 (client-go's Orbit.GetTools still sends that GET). GitLab offers the tool list nowhere else. A list GitLab answers in pages is followed by its nextCursor.

Jump to

Keyboard shortcuts

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