{"modulePath":"github.com/github/github-mcp-server/v2","version":"v2.2.0","isLatest":false,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package context\n\n## Functions\n\n```go\nfunc GetExcludeTools(ctx context.Context) []string\n```\nGetExcludeTools retrieves the excluded tools from the context\n\n```go\nfunc GetGraphQLFeatures(ctx context.Context) []string\n```\nGetGraphQLFeatures retrieves GraphQL feature flags from the context\n\n```go\nfunc GetHeaderFeatures(ctx context.Context) []string\n```\nGetHeaderFeatures retrieves raw HTTP request feature flags from context.\n\n```go\nfunc GetTokenScopes(ctx context.Context) ([]string, bool)\n```\nGetTokenScopes retrieves token scopes from the context\n\n```go\nfunc GetTools(ctx context.Context) []string\n```\nGetTools retrieves the tools from the context\n\n```go\nfunc GetToolsets(ctx context.Context) []string\n```\nGetToolsets retrieves the active toolsets from the context\n\n```go\nfunc HasUISupport(ctx context.Context) (supported bool, ok bool)\n```\nHasUISupport retrieves the MCP Apps UI support flag from context.\n\n```go\nfunc IsInsidersMode(ctx context.Context) bool\n```\nIsInsidersMode retrieves the insiders mode state from the context\n\n```go\nfunc IsLockdownMode(ctx context.Context) bool\n```\nIsLockdownMode retrieves the lockdown mode state from the context\n\n```go\nfunc IsReadonly(ctx context.Context) bool\n```\nIsReadonly retrieves the read-only mode state from the context\n\n```go\nfunc WithExcludeTools(ctx context.Context, tools []string) context.Context\n```\nWithExcludeTools adds the excluded tools to the context\n\n```go\nfunc WithGraphQLFeatures(ctx context.Context, features ...string) context.Context\n```\nwithGraphQLFeatures adds GraphQL feature flags to the context\n\n```go\nfunc WithHeaderFeatures(ctx context.Context, features []string) context.Context\n```\nWithHeaderFeatures stores raw HTTP request feature flags in context.\n\n```go\nfunc WithInsidersMode(ctx context.Context, enabled bool) context.Context\n```\nWithInsidersMode adds insiders mode state to the context\n\n```go\nfunc WithLockdownMode(ctx context.Context, enabled bool) context.Context\n```\nWithLockdownMode adds lockdown mode state to the context\n\n```go\nfunc WithMCPMethodInfo(ctx context.Context, info *MCPMethodInfo) context.Context\n```\nWithMCPMethodInfo stores the MCPMethodInfo in the context.\n\n```go\nfunc WithReadonly(ctx context.Context, enabled bool) context.Context\n```\nWithReadonly adds read-only mode state to the context\n\n```go\nfunc WithTokenInfo(ctx context.Context, tokenInfo *TokenInfo) context.Context\n```\nWithTokenInfo adds TokenInfo to the context\n\n```go\nfunc WithTokenScopes(ctx context.Context, scopes []string) context.Context\n```\nWithTokenScopes adds token scopes to the context\n\n```go\nfunc WithTools(ctx context.Context, tools []string) context.Context\n```\nWithTools adds the tools to the context\n\n```go\nfunc WithToolsets(ctx context.Context, toolsets []string) context.Context\n```\nWithToolsets adds the active toolsets to the context\n\n```go\nfunc WithUISupport(ctx context.Context, supported bool) context.Context\n```\nWithUISupport stores whether the client supports MCP Apps UI in the context. This is used by HTTP/stateless servers where the go-sdk session may not persist client capabilities across requests.\n\n## Types\n\n```go\ntype MCPMethodInfo struct {\n\t// Method is the MCP method being called (e.g., \"tools/call\", \"tools/list\", \"initialize\")\n\tMethod string\n\t// ItemName is the name of the specific item being accessed (tool name, resource URI, prompt name)\n\t// Only populated for call/get methods (tools/call, prompts/get, resources/read)\n\tItemName string\n\t// RawArguments contains the unmaterialized tool arguments for tools/call requests.\n\tRawArguments json.RawMessage\n\t// NormalizedArguments contains canonical arguments prepared by HTTP scope\n\t// middleware so tool adapters do not rerun non-idempotent normalizers.\n\tNormalizedArguments json.RawMessage\n\t// ArgumentsNormalized distinguishes an intentionally empty normalized value\n\t// from a request that has not been normalized.\n\tArgumentsNormalized bool\n\t// ProtocolVersion and ClientCapabilities describe the requesting MCP client\n\t// when stateless HTTP parsing makes them available before registration.\n\tProtocolVersion    string\n\tClientCapabilities *mcp.ClientCapabilities\n}\n```\nMCPMethodInfo contains pre-parsed MCP method information extracted from the JSON-RPC request. This is populated early in the request lifecycle to enable:\n\n  - Inventory filtering via ForMCPRequest (only register needed tools/resources/prompts)\n  - Avoiding duplicate JSON envelope parsing in downstream middleware\n  - Performance optimization for per-request server creation\n\n```go\nfunc MCPMethod(ctx context.Context) (*MCPMethodInfo, bool)\n```\nMCPMethod retrieves the MCPMethodInfo from the context.\n\n```go\nfunc (info *MCPMethodInfo) DecodeArguments() (map[string]any, error)\n```\nDecodeArguments materializes tool arguments when request middleware needs call-specific values. Invalid argument shapes are returned to the caller so the request can continue to the tool handler's normal validation path.\n\n```go\ntype TokenInfo struct {\n\tToken     string\n\tTokenType utils.TokenType\n}\n```\n\n```go\nfunc GetTokenInfo(ctx context.Context) (*TokenInfo, bool)\n```\nGetTokenInfo retrieves the authentication token from the context\n\n","path":"github.com/github/github-mcp-server/v2/pkg/context","name":"context","synopsis":"","isRedistributable":true}
