Class UntrustedText
java.lang.Object
com.eqixiac.equinix.mcp.server.UntrustedText
The one place tool output handles text that came from a remote system: Equinix API fields
(ticket references, device names, service-profile names, error messages), PeeringDB names, and
the messages of failed pricing lookups. Such text reaches the calling model, which must not
mistake it for instructions.
Every value written through this class is
- sanitised: C0/C1 control characters (newlines and tabs become a space), Unicode format characters (bidirectional overrides, zero-width characters), line/paragraph separators and unpaired surrogates are removed;
- bounded: values longer than
MAX_FIELD_CHARScharacters are cut and end with a[truncated N chars]marker; - labelled: it is stored as an
UntrustedText.Untrustedtext node. Before the result leaves the server,McpToolAdaptercollects the JSON-pointer path of every such node into a top-level "untrusted_data" block that tells the model the text is data.
Error results are sanitised and bounded the same way, and an error that carries a remote service's message says so.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classA text node holding sanitised remote text. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe top-level result field that lists untrusted paths.static final intLongest engine-generated document kept (a summary or Markdown report that embeds remote names), in characters.static final intLongest error message kept, in characters.static final intLongest untrusted field value kept, in characters. -
Method Summary
Modifier and TypeMethodDescriptionstatic voidAppends remote text toarrayas a labelled, sanitised element.static com.fasterxml.jackson.databind.JsonNodeA labelled, sanitised node for a long document that embeds remote text (an engine's summary or Markdown report), bounded atMAX_DOCUMENT_CHARSinstead ofMAX_FIELD_CHARS.static com.fasterxml.jackson.databind.JsonNodestatic voidPuts remote text intoparentas a labelled, sanitised field.static StringRemoves control, format and separator characters and bounds the length.
-
Field Details
-
LABEL_FIELD
The top-level result field that lists untrusted paths.- See Also:
-
MAX_FIELD_CHARS
public static final int MAX_FIELD_CHARSLongest untrusted field value kept, in characters.- See Also:
-
MAX_DOCUMENT_CHARS
public static final int MAX_DOCUMENT_CHARSLongest engine-generated document kept (a summary or Markdown report that embeds remote names), in characters.- See Also:
-
MAX_ERROR_CHARS
public static final int MAX_ERROR_CHARSLongest error message kept, in characters.- See Also:
-
-
Method Details
-
sanitize
-
node
- Parameters:
raw- remote text- Returns:
- a labelled, sanitised text node, or a null node for
null
-
document
A labelled, sanitised node for a long document that embeds remote text (an engine's summary or Markdown report), bounded atMAX_DOCUMENT_CHARSinstead ofMAX_FIELD_CHARS.- Parameters:
raw- the document- Returns:
- the node, or a null node for
null
-
put
-
add
Appends remote text toarrayas a labelled, sanitised element.- Parameters:
array- the array to append toraw- the remote text (may benull)
-