Manage per-tool context
- Last Updated: February 11, 2026
- 3 minute read
- OpenEdge
- Version 13.0
- Documentation
Per-tool context enriches operation descriptions with curated snippets from a context directory. These snippets provide domain-specific hints such as field semantics, guardrails, and usage caveats. The goal is to improve guidance for LLMs and UI consumers without altering schemas or business logic.
Per-tool context enrichment
When enabled, per-tool context appends a Context block to the operation
description. The block can preserve newlines or appear as a single line.
- In newline-preserving mode, the
contextblock appears as:Context: Allowed status values: NEW | RUNNING | COMPLETE Max page size: 100 … (truncated) - In single-line mode, the
contextblock appears as:Context: Allowed status values: NEW | RUNNING | COMPLETE … (truncated)
Activate per-tool context
- Set the feature gate
openapi_visibility.per_tool_context_enabledto true. By default it is set to disabled. - Resolve the context directory in the following order:
- The context directory uses the explicit value of the
openapi_visibility.context_dirproperty if it is provided. - If the property is not provided, it checks for a
./contextdirectory relative to the current working directory. - If neither of the above exists, it falls back to the
context/directory located in the repository source tree.
- The context directory uses the explicit value of the
- For each operation with an
operationId, look for<operationId>.mdand then<operationId>.txtin the context directory. - Sort candidate files by descending priority and then by
operationId. Truncate the list toper_tool_context_max_filesif set. - Append each selected file according to global defaults if not already
present. Global context supports only
global.md. Other filenames are ignored.
Append global context from global.md
global.md exists in the resolved context directory, its content is
appended to:spec.info.descriptionfor a high-level overview with the help of the annotator.- Every operation description as a
Global Context:block or line when context features are enabled.
| Setting | Description |
|---|---|
| Size limit | The
openapi_visibility.global_context_char_limit
property sets the size limit for global context. The default
value is 1500 characters, and the maximum allowed is 2000
characters. |
| Formatting | Formatting respects the settings defined in
_index.json.defaults for newline
preservation and truncation. |
global.md file when using the Global Context feature in
OpenAPI visibility and context management:- Data freshness—State how often the inventory or data is updated.
- Pagination—Provide limits and usage hints for pagination.
- Rate limiting—Indicate throttling behavior for large queries.
|
Control formatting with _index.json
_index.json file inside the context directory provides optional global
formatting controls and operation priorities. For example:
|
- Only
priorityis honored per operation. Legacy keys such aspreserve_newlines,max_lines, andchar_limitare ignored. - Defaults apply globally to all operations.
Apply formatting and truncation rules
_index.json.defaults. The following table explains each
setting:| Setting | Data type | Description |
|---|---|---|
preserve_newlines |
Boolean | If false, the context is collapsed
into a single line. If true, original
lines are preserved up to the value of
max_lines. |
max_lines |
Integer | Specifies the maximum number of lines retained when
preserve_newlines is
true. If the limit exceeds, the
system adds … (truncated) to
indicate truncation. |
char_limit |
Integer | Defines the maximum number of characters before line splitting occurs. The hard upper bound is 2000 characters. Truncation respects newline boundaries whenever possible to avoid mid-line cuts and appeands … (truncated). |
Apply priority and limits
Operations are sorted by priority. If per_tool_context_max_files is set, only
the first N operations are enriched. This allows staged rollouts, such as
highlighting the top 10 most-used operations.
Ensure idempotency and avoid collisions
When enriching API specifications with per-tool context, the system must ensure that the process does not create duplicate entries or introduce inconsistencies.
Idempotency ensures that running the enrichment multiple times produces the same result without duplication. If the enrichment process is executed more than once, the system checks for an identical formatted block in the operation description. If the block already exists, it is skipped. This ensures that repeated runs do not add duplicate context.
Collision avoidance prevents near-duplicate content from being added when similar information already exists in the operation description. Before adding new context, the system compares the first line of the raw file (up to 40 characters) with the existing description. If this snippet already appears, enrichment is skipped. This prevents adding content that is too similar to manually documented details.
Review logging behavior during enrichment
- If per-tool context is successfully added, the log message is:
This message confirms the number of operations enriched and the directory used.Visibility: added per-tool context to X operations (dir=...) - If unsupported per-operation keys are removed, the log message is:
Visibility: stripped N unsupported per-operation context keysThis message indicates how many invalid keys were detected and stripped during processing.
Avoid common pitfalls when using per-tool context
| Pitfall | Symptom | Fix |
|---|---|---|
Forgetting to enable
per_tool_context_enabled |
No context lines appear in the operation descriptions | Set the per_tool_context_enabled flag to
true in the configuration. |
| Using per-operation formatting keys | Formatting keys are silently ignored | Move all formatting settings to the defaults
section in _index.json. |
| Large context files | Context is aggressively truncated | Refactor the content into concise bullet points to fit within limits. |
| Duplicate run of enrichment | No duplication occurs (expected behavior) | This is working as intended. No action is required. |
Missing operationId in operations |
No context is injected | Ensure that every operation in the specification includes an
operationId. |