Skip to content

McpToolHeaders

Namespace: Vercel.AI.Mcp

public static class McpToolHeaders

Reads x-mcp-header annotations and encodes Mcp-Param-* headers.

Inheritance: object

View source

CreateHeaders(IReadOnlyList<Binding>, JsonElement)

Section titled “CreateHeaders(IReadOnlyList<Binding>, JsonElement)”
public static IReadOnlyDictionary<string, string> CreateHeaders(IReadOnlyList<McpToolHeaders.Binding> bindings, JsonElement arguments)

Builds Mcp-Param-* headers from tool arguments.

Parameters

Name Type Description
bindings IReadOnlyList<McpToolHeaders.Binding>
arguments JsonElement

Returns: IReadOnlyDictionary<string, string>

View source

public static string EncodeValue(string value)

Encodes a header value, using the base64 sentinel when the text is not plain ASCII.

Parameters

Name Type Description
value string

Returns: string

View source

public static McpToolHeaders.BindingResult GetBindings(JsonElement inputSchema)

Collects statically reachable x-mcp-header annotations.

Parameters

Name Type Description
inputSchema JsonElement

Returns: McpToolHeaders.BindingResult

View source

Apache-2.0 · Copyright 2023 Vercel, Inc. · unofficial community port, not an official Vercel product