MCPcopy
hub / github.com/infinitered/reactotron / resolveClientId

Function resolveClientId

lib/reactotron-mcp/src/tools.ts:47–63  ·  view source on GitHub ↗
(
  server: ReactotronServer,
  requestedClientId?: string
)

Source from the content-addressed store, hash-verified

45}
46
47function resolveClientId(
48 server: ReactotronServer,
49 requestedClientId?: string
50): { clientId?: string; error?: string } {
51 const connections = server.connections as any[]
52
53 if (connections.length === 0) {
54 return { error: "No apps connected to Reactotron." }
55 }
56
57 if (connections.length > 1 && !requestedClientId) {
58 const apps = connections.map((c) => `${c.name} (${c.platform}): ${c.clientId}`).join(", ")
59 return { error: `Multiple apps connected. Specify clientId. Available: ${apps}` }
60 }
61
62 return { clientId: requestedClientId || connections[0]?.clientId }
63}
64
65function textResult(data: unknown, guidance?: string) {
66 return { content: [{ type: "text" as const, text: safeSerialize(data, MAX_RESPONSE_CHARS, guidance) }] }

Callers 1

registerToolsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected