MCPcopy Create free account
hub / github.com/callstack/agent-device / cleanSchemaParseMessage

Function cleanSchemaParseMessage

src/daemon/server/http-server.ts:381–387  ·  view source on GitHub ↗
(message: string)

Source from the content-addressed store, hash-verified

379// (e.g. `$.positionals: Expected an array`). Strip the `$` sigil so the wire message
380// stays user-facing without leaking the schema's internal path representation.
381function cleanSchemaParseMessage(message: string): string {
382 const separator = message.indexOf(': ');
383 if (separator === -1 || !message.startsWith('$')) return message;
384 const field = message.slice(0, separator).replace(/^\$\.?/, '');
385 const detail = message.slice(separator + 2);
386 return field ? `${field}: ${detail}` : detail;
387}
388
389// Validate the command params at the boundary so malformed client input is rejected as
390// INVALID_ARGS (-> JSON-RPC -32602 / HTTP 400) instead of leaking as an internal 500.

Callers 1

parseCommandRpcParamsFunction · 0.85

Calls 1

startsWithMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…