5.5 The build_context_prompt tool

Returns a fully assembled prompt with relevant facts in a fixed envelope, suitable for piping into a non-MCP LLM.

5.5.1 Inputs

user_prompt

Required string. The user’s actual question.

limit

Integer. Optional. Number of facts to include. Default 8.

max_chars

Integer. Optional. Hard cap on the total prompt size in characters. The tool greedy-packs the highest-scoring facts that fit, stopping when adding the next would exceed max_chars. At least one fact is always included if any matched.

min_score

Number, 0–1. Optional. Lower bound on similarity for included facts.

tags

Array of strings. Optional. Tag filter, same semantics as recall.

5.5.2 Output

{
  "ok": true,
  "prompt": "The following are previously known facts:\\n\\n[fact 1]\\n\\n[fact 2]\\n\\n-----------------\\n\\nThe following is the user's prompt:\\n\\n[user prompt]"
}

If no relevant facts were found, the body says "No relevant previously known facts were found." instead of listing facts.

5.5.3 Errors

INVALID_INPUT, EMBEDDING_ERROR, DATABASE_ERROR.