Knowledgespecs
GET/repositories/{repo_id}/specs/graph
Walk the document dependency graph, observed edges beside declared ones
get_spec_graph
tree:read
A token needs thetree:readscope: Browse repository trees and blobsGranted bymcp_agent,mcp_agent_write,read_api,read_repository,write_api,write_repository.Every operation this scope unlocks
Answers the documents reachable from root within depth hops (at most 6), or the whole corpus
when root is omitted, with two sets of edges: the links the documents actually make, and the
dependencies each declares in its front matter. Comparing the two shows dependencies that are
used but undeclared, or declared but unused. At most 500 documents are returned, and the
response says when the walk was cut short. Anyone who can see the repository may call it; on a
public repository that includes callers who are not signed in.
Parameters
Path
- repo_idRepositoryId (string · uuid)The repository whose corpus is indexed
Query
- rootstringoptionalWalk outward from one document; omitted returns the whole graph, node-capped
- depthinteger · int32optionalHops to follow from the root (1-6, clamped)
Responses
200The reachable documents, their observed edges, and the depends_on each claimsapplication/json
declared_edgesarray of SpecDeclaredEdge
- The SpecDeclaredEdge schema
- from_doc_idstring
- resolvedbooleanFalse when the named document is not in this repository's index.
- to_doc_idstring
- depthinteger · int32
nodesarray of SpecGraphNode
- The SpecGraphNode schema
- depthinteger · int32Hops from the root, or
0for every node when no root was named. - doc_idstring
- titlestring
- kindstring or nulloptional
observed_edgesarray of SpecGraphEdge
- The SpecGraphEdge schema
- cites_idboolean
- from_doc_idstring
- to_doc_idstring
- weightinteger · int64
- truncatedbooleanTrue when the graph stopped at its limit of 500 documents, so it shows only part of the real graph.
- rootstring or nulloptional
200 exampleSynthesized example
{
"declared_edges": [
{
"from_doc_id": "21ef4f4d-a6ae-4778-a25d-e0d3f0c3cbe8",
"resolved": false,
"to_doc_id": "4bfb52c1-4809-4376-9a30-f355b91d40d2"
},
{
"from_doc_id": "c86c0960-4b8c-4fee-b46b-cc98f75f5e77",
"resolved": false,
"to_doc_id": "6643ada8-e29e-485b-844a-01816ba7a8d3"
}
],
"depth": 61,
"nodes": [
{
"depth": 76,
"doc_id": "ced37b21-ef52-43f2-85f1-a93e6eaa7ce3",
"title": "Pin a page's payload to the build that rendered it"
}
],
"observed_edges": [
{
"cites_id": false,
"from_doc_id": "63bd96c0-9f1c-43f7-b418-4ae4aeba2816",
"to_doc_id": "bd7aa40a-e54b-4c9f-93b6-4b4c662d7aec",
"weight": 19
}
],
"truncated": false,
"root": "root-b8f9"
}
400Bad request — a path parameter is not a well-formed value of its typeapplication/json
Error codes
- BAD_REQUESTThe request is malformed: a parameter or a body field is not a well-formed value of its type
errorErrorBody
- The ErrorBody schema
- codestringThe coarse category, tied to the status:
NOT_FOUND,CONFLICT,INSUFFICIENT_SCOPE. Every error has one; the API reference's error catalogue lists them all. - messagestringWhat went wrong, for a person. Written to be read, not parsed: match on
reasonorcode. - fieldstring or nulloptionalOn a
400that refused one field's value, the field, as its JSON path:email,items[0].name. Put the message under that input. Absent on every other error. - reasonstring or nulloptionalThe specific code, when the error has one:
LAST_ORGANIZATION_OWNER,BRANCH_PROTECTED. The message starts with it too. Match on this when it is present, and oncodeotherwise. - required_scopestring or nulloptionalThe scope the access token was missing, on
INSUFFICIENT_SCOPE. - violationsanyoptionalPresent on the structured-validation errors (
PROVIDER_VALIDATION_FAILEDper-node,PIPELINE_VALIDATION_FAILEDDAG): a JSON array of the offending elements, so a caller can fix every one in a single round-trip. Absent (omitted) on every other error.
400 exampleSynthesized example
{
"error": {
"code": "code-f941",
"message": "Draw the region map from operation density"
}
}
401Unauthenticated — no credential, or an invalid oneapplication/json
Error codes
- UNAUTHORIZEDNo credential was sent, or the one sent is invalid, expired or revoked
errorErrorBody
- The ErrorBody schema
- codestringThe coarse category, tied to the status:
NOT_FOUND,CONFLICT,INSUFFICIENT_SCOPE. Every error has one; the API reference's error catalogue lists them all. - messagestringWhat went wrong, for a person. Written to be read, not parsed: match on
reasonorcode. - fieldstring or nulloptionalOn a
400that refused one field's value, the field, as its JSON path:email,items[0].name. Put the message under that input. Absent on every other error. - reasonstring or nulloptionalThe specific code, when the error has one:
LAST_ORGANIZATION_OWNER,BRANCH_PROTECTED. The message starts with it too. Match on this when it is present, and oncodeotherwise. - required_scopestring or nulloptionalThe scope the access token was missing, on
INSUFFICIENT_SCOPE. - violationsanyoptionalPresent on the structured-validation errors (
PROVIDER_VALIDATION_FAILEDper-node,PIPELINE_VALIDATION_FAILEDDAG): a JSON array of the offending elements, so a caller can fix every one in a single round-trip. Absent (omitted) on every other error.
401 exampleSynthesized example
{
"error": {
"code": "code-04f0",
"message": "Pin a page's payload to the build that rendered it"
}
}
403Forbidden — the caller's access level or token scope is insufficientapplication/json
Error codes
- FORBIDDENYou are signed in but may not do this here;
reasonnames the permission or the rule that refused it - INSUFFICIENT_SCOPEThe access token lacks the scope this operation needs;
required_scopenames it - PERMISSION_REQUIREDYou need a permission you do not hold here; the message names it
errorErrorBody
- The ErrorBody schema
- codestringThe coarse category, tied to the status:
NOT_FOUND,CONFLICT,INSUFFICIENT_SCOPE. Every error has one; the API reference's error catalogue lists them all. - messagestringWhat went wrong, for a person. Written to be read, not parsed: match on
reasonorcode. - fieldstring or nulloptionalOn a
400that refused one field's value, the field, as its JSON path:email,items[0].name. Put the message under that input. Absent on every other error. - reasonstring or nulloptionalThe specific code, when the error has one:
LAST_ORGANIZATION_OWNER,BRANCH_PROTECTED. The message starts with it too. Match on this when it is present, and oncodeotherwise. - required_scopestring or nulloptionalThe scope the access token was missing, on
INSUFFICIENT_SCOPE. - violationsanyoptionalPresent on the structured-validation errors (
PROVIDER_VALIDATION_FAILEDper-node,PIPELINE_VALIDATION_FAILEDDAG): a JSON array of the offending elements, so a caller can fix every one in a single round-trip. Absent (omitted) on every other error.
403 exampleSynthesized example
{
"error": {
"code": "code-8d9f",
"message": "Pin a page's payload to the build that rendered it"
}
}
404Not found — or found and private, which is masked as absentapplication/json
Error codes
- NOT_FOUNDThe resource does not exist — or exists and you cannot see it: a private resource you have no access to answers exactly as an absent one does
errorErrorBody
- The ErrorBody schema
- codestringThe coarse category, tied to the status:
NOT_FOUND,CONFLICT,INSUFFICIENT_SCOPE. Every error has one; the API reference's error catalogue lists them all. - messagestringWhat went wrong, for a person. Written to be read, not parsed: match on
reasonorcode. - fieldstring or nulloptionalOn a
400that refused one field's value, the field, as its JSON path:email,items[0].name. Put the message under that input. Absent on every other error. - reasonstring or nulloptionalThe specific code, when the error has one:
LAST_ORGANIZATION_OWNER,BRANCH_PROTECTED. The message starts with it too. Match on this when it is present, and oncodeotherwise. - required_scopestring or nulloptionalThe scope the access token was missing, on
INSUFFICIENT_SCOPE. - violationsanyoptionalPresent on the structured-validation errors (
PROVIDER_VALIDATION_FAILEDper-node,PIPELINE_VALIDATION_FAILEDDAG): a JSON array of the offending elements, so a caller can fix every one in a single round-trip. Absent (omitted) on every other error.
404 exampleSynthesized example
{
"error": {
"code": "code-9f56",
"message": "Stream pipeline status into the run header"
}
}
CLI
gitmoap specs get-spec-graph
- --repo-ididThe repository whose corpus is indexed (id or owner/repo path)
- --depthnumberoptionalHops to follow from the root (1-6, clamped)
- --rootstringoptionalWalk outward from one document; omitted returns the whole graph, node-capped