knowledge_graph

kg_search

FIND an artefact by its name, friendly id or uuid with artefactMetadataOnly:true. This works in every organisation, with or without the knowledge graph. Without that flag the tool ANSWERS questions from inside the content (facts, themes, relationships) through the knowledge modes below, which need the organisation's knowledge graph switched on: where it is off, those calls are refused with a message saying so. The knowledge modes will not reliably find a thing by its title.

FIND (artefactMetadataOnly:true): matches title, friendly id and uuid, never document content, across documents, whiteboards, plans, tasks, improvements and compliance frameworks that the caller can open and the organisation has switched on. Ignores mode. Narrow it with artefactTypes, projectId or workspaceId; page with offset. Returns { artefacts: [{ result_type, id, friendly_id, title, snippet, document_id, project_id, href }], total }. To search inside document bodies use listDocuments (full-content grep).

KNOWLEDGE MODES (need the knowledge graph; pass projectId or workspaceId). PICK THE MODE THAT FITS THE QUERY:

• mode='local' (default): for SPECIFIC factual questions ("what does section 15 say about deposits?", "who is the Chief Counsel?"). Searches individual passages of the content by wording and by meaning. Returns precise excerpts with citations.

• mode='global': for THEMATIC / OVERVIEW / SUMMARY questions ("what are the main themes", "give me an overview of the project", "what topics does this cover"). Returns summaries of the communities (groups of closely related entities) found in the content, plus curated wiki pages. Far better than 'local' for big-picture queries, because each summary already draws on many passages. ALWAYS PREFER over 'local' when the user asks for themes / summary / overview / topic landscape.

• mode='graph': for RELATIONSHIP questions ("what's connected to entity X?", "who cites Section 5?"). Returns the entities connected to the one you name, and how they are related; depth sets how many links to follow. Pass query OR srcEntityId.

• mode='path': for CONNECTION questions ("how does X relate to Y?"). Returns up to five of the shortest chains of relationships between two entities, each step saying how it relates to the one before, with a one-line summary; or, when there is none, a message saying why. Pass srcEntityId AND dstEntityId (both in the same project); depth is the most steps a chain may have.

• mode='ppr': for MULTI-HOP discovery ("what's relevant to X, even indirectly?"). Starts from the entities closest to the query and follows their relationships outwards, giving more weight to links people authored than to links inferred from text. Best when 'local' returns too few results and the answer means following several relationships in a row.

Quick decision tree:

  • User wants to FIND a named artefact ("the GTM plan", "DOC-123", a uuid) → artefactMetadataOnly:true
  • User asks for an overview/summary/themes → 'global'
  • User asks a specific question with a clear answer → 'local'
  • User asks 'how is X connected to Y' → 'path' (with both entity IDs)
  • User asks 'what's near entity X' → 'graph' (with srcEntityId)
  • 'local' returned nothing useful and the question is broad → retry with 'ppr'

DATED FACTS: a knowledge-mode response also carries datedFacts for the entities the query names: what holds now by default, what held on a day with asOf, or the whole history with history:true, each fact with its dates, how it ended if it has, and its sources. Prefer them for "who owns X now", "what was X in March", "when did X change".

post/tools/kg_search

Request

  • Base URL: https://api.stablebaseline.io/functions/v1/cloud-serve/api/v1
  • URL: https://api.stablebaseline.io/functions/v1/cloud-serve/api/v1/tools/kg_search
  • Auth: HTTP bearer

Request body

querystring

What to find or ask. With artefactMetadataOnly:true, the artefact's name, friendly id (for example DOC-123) or uuid. Otherwise a natural-language question: required for local, global and ppr; optional for graph (use srcEntityId instead).

artefactMetadataOnlyboolean

Find artefacts by name, friendly id or uuid instead of answering a question. Works in every organisation, with or without the knowledge graph. Matches title, friendly id and uuid only, never document content. Default false.

artefactTypesstring[]

Only with artefactMetadataOnly:true. Restrict the search to these artefact types. Omit to search all of them. Unknown values are rejected rather than ignored.

offsetnumber

Only with artefactMetadataOnly:true. Skip this many results for paging.

mode'local' | 'global' | 'graph' | 'path' | 'ppr'

Knowledge mode; these need the knowledge graph. Ignored with artefactMetadataOnly:true. See the tool description for when to use each, and strongly prefer 'global' for thematic or overview questions.

projectIdstring

The project to search. For the knowledge modes pass this or workspaceId: the knowledge graph is switched on per project or workspace, and a call with neither is refused unless the whole organisation is switched on. With artefactMetadataOnly:true it is optional and narrows the search to this project. Use listProjects to find the id.

workspaceIdstring

Alternative to projectId: the whole workspace. For the knowledge modes give one of the two. With artefactMetadataOnly:true it is optional and narrows the search to this workspace.

srcEntityIdstring

Required for mode='path'. Optional source entity for mode='graph'.

dstEntityIdstring

Required for mode='path'. Target entity to find a path TO.

depthnumber

graph: how many links away to look, 1 to 4 (default 2). path: the most steps a chain may have, 1 to 6 (default 4).

limitnumber

Most results to return, up to 50. Default 20, or 30 with artefactMetadataOnly:true.

asOfstring

Dated facts: return what held on this day (YYYY-MM-DD) instead of what holds now. For example the owner, status or supplier as it was on a past date.

historyboolean

Dated facts: return every fact with its dates, including facts that have ended (and how they ended) and planned ones, oldest first. Use for "how did X change" or "what was X before".

timeZonestring

Dated facts: the IANA time zone to give days in (for example Australia/Sydney, Asia/Kolkata, America/New_York). Defaults to the user's saved time zone, else UTC. Pass the user's zone when you know it, so "today" and dates match their calendar.

Response

Tool result (shape varies per tool — refer to the tool's docs for the exact return value).

object required

Changes

No recorded changes to this operation across all 1 revision of this API.