Documentation
¶
Overview ¶
Package wire preserves JSON field order and JavaScript's printable JSON format at tap's CLI and MCP boundaries.
Index ¶
- func Capture(ctx context.Context) (context.Context, *json.RawMessage)
- func Decode(data []byte) (any, error)
- func DecodeExact(data []byte) (any, error)
- func DecodeExactOwned(data []byte) (any, error)
- func ForwardMeta(meta mcp.Meta) mcp.Meta
- func JSON(value any, pretty bool) ([]byte, error)
- func Number(s string) float64
- func String(v any) string
- func Take(ctx context.Context) (context.Context, *json.RawMessage)
- type Field
- type Object
- type Result
- type Transport
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Decode ¶
Decode parses JSON while retaining object property order. Well-formed JSON is read in one pass; anything that pass is not sure of, malformed input included, is read by encoding/json instead, so values and errors are the ones encoding/json gives.
func DecodeExact ¶
DecodeExact preserves numeric JSON spelling for tool arguments and retained/inline results. Configuration and gateway control fields continue to use Decode's float64 values.
func DecodeExactOwned ¶
DecodeExactOwned is DecodeExact for data the caller owns and will not change: the strings of the value it returns share data's memory instead of being copied out of it.
func ForwardMeta ¶
ForwardMeta keeps application metadata but removes protocol identity and progress tokens that belong to the current hop; tap does not relay progress notifications.
func JSON ¶
JSON encodes JSON without HTML escapes, with optional two-space indentation. Values made of objects, arrays, strings, numbers, booleans and null are written in one pass; any other value is encoded by encoding/json, whose output the pass matches byte for byte.
Types ¶
type Object ¶
type Object []Field
Object retains JavaScript property order: integer keys first, then insertion order.
func (Object) MarshalJSON ¶
MarshalJSON encodes an object without sorting its keys, for encoding/json.
type Result ¶
type Result struct {
mcp.ResultBase
Value any
}
Result carries an already-shaped JSON result through SDK middleware unchanged.
func (*Result) MarshalJSON ¶
MarshalJSON preserves the result's field order and explicit false/null values.