MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / orgIdOf

Function orgIdOf

e2e/cloud/mcp-execution-metering.test.ts:26–32  ·  view source on GitHub ↗
(bearer: string)

Source from the content-addressed store, hash-verified

24/** The org the bearer is scoped to — the Autumn customer id `trackExecution`
25 * meters against — read from the JWT's public claims. */
26const orgIdOf = (bearer: string): string => {
27 const claims = JSON.parse(Buffer.from(bearer.split(".")[1] ?? "", "base64url").toString()) as {
28 readonly org_id?: string;
29 };
30 if (!claims.org_id) throw new Error("orgIdOf: bearer carries no org_id claim");
31 return claims.org_id;
32};
33
34const textOf = (result: { content?: unknown; toolResult?: unknown }): string =>
35 ((result.content ?? []) as Array<{ type: string; text?: string }>)

Callers 1

Calls 1

toStringMethod · 0.80

Tested by

no test coverage detected