twctx

package
v1.35.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 26, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package twctx carries the per-request values the MCP server derives from the caller's bearer token: which installation it belongs to, the token itself, the scopes it grants, and whether the installation lives in another region.

It exists as its own package so tool helpers can read those values without importing the server configuration, which would otherwise make every tool package depend on the whole startup path.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BearerTokenFromContext

func BearerTokenFromContext(ctx context.Context) (string, bool)

BearerTokenFromContext returns the bearer token from the context, if any.

func CustomerURLFromContext

func CustomerURLFromContext(ctx context.Context) (string, bool)

CustomerURLFromContext returns the customer URL from the context, if any.

func IsCrossRegion

func IsCrossRegion(ctx context.Context) bool

IsCrossRegion reports whether the request targets an installation in another region.

func ScopesFromContext

func ScopesFromContext(ctx context.Context) []string

ScopesFromContext returns the scopes granted to the bearer token, if any.

func WithBearerToken

func WithBearerToken(ctx context.Context, bearerToken string) context.Context

WithBearerToken returns a new context with the given bearer token.

func WithCrossRegion

func WithCrossRegion(ctx context.Context, crossRegion bool) context.Context

WithCrossRegion adds a boolean value to the context indicating if the request is cross-region.

func WithCustomerURL

func WithCustomerURL(ctx context.Context, customerURL string) context.Context

WithCustomerURL returns a new context with the given customer URL.

func WithScopes

func WithScopes(ctx context.Context, scopes []string) context.Context

WithScopes adds all scopes related to the bearer token to the context.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL