MCPcopy Index your code
hub / github.com/simstudioai/sim / substituteVariables

Function substituteVariables

apps/sim/app/api/tools/stagehand/agent/route.ts:77–86  ·  view source on GitHub ↗

* Substitutes variable placeholders in text with their actual values * Variables are referenced using %key% syntax

(text: string, variables: Record<string, string> | undefined)

Source from the content-addressed store, hash-verified

75 * Variables are referenced using %key% syntax
76 */
77function substituteVariables(text: string, variables: Record<string, string> | undefined): string {
78 if (!variables) return text
79
80 let result = text
81 for (const [key, value] of Object.entries(variables)) {
82 const placeholder = `%${key}%`
83 result = result.split(placeholder).join(value)
84 }
85 return result
86}
87
88export const POST = withRouteHandler(async (request: NextRequest) => {
89 const auth = await checkInternalAuth(request)

Callers 1

route.tsFile · 0.85

Calls 1

joinMethod · 0.80

Tested by

no test coverage detected