scriptcallsite

package
v1.137.1 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package scriptcallsite names where in a managed script a host call was made (#1907), so a run's calls can be drawn on the card of the Flow diagram (#1906) that makes them.

A call site is the source position of every call on the script's stack when the call was made, outermost first, each written "line:col" at the call's opening parenthesis: the top-level call of main() and every function call on the way down to the platform.* call itself. That is what the Starlark thread reports (Thread.CallStack) and what the flow graph records on each card, so the two meet on equality: a helper called from two places is two call sites and two cards.

It travels three ways. Inside a run it rides the call's context (With, From). Across the in-process MCP session to the server it rides the request's _meta under MetaKey, which the audit middleware records on the call's audit row. And a failed run's backtrace names the site it failed at (FromBacktrace).

Index

Constants

View Source
const MetaKey = "mcp-data-platform/call_site"

MetaKey is the _meta key a script's tool call carries its call site under.

Variables

This section is empty.

Functions

func From

func From(ctx context.Context) []string

From is the call site ctx carries, or nil.

func FromBacktrace

func FromBacktrace(text string) []string

FromBacktrace is the call site a failed run's backtrace names: the script frames it lists, outermost first. The last is the call the run failed in.

func FromMeta

func FromMeta(meta map[string]any) []string

FromMeta reads a call site from a request's _meta, or nil when it carries none or carries something that is not one.

func Of

func Of(thread *starlark.Thread) []string

Of is the call site of the call being made on thread: the positions of the script's frames, outermost first, leaving out the builtin being called. A builtin's frame has no position, which is how it is told from the script's; the script's own frames carry whatever name the script runs under.

func With

func With(ctx context.Context, site []string) context.Context

With returns ctx carrying a call site.

Types

This section is empty.

Jump to

Keyboard shortcuts

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