MCPcopy Create free account
hub / github.com/Shinplex/rever / retoolSendMessage

Function retoolSendMessage

workers/retool.ts:99–119  ·  view source on GitHub ↗
(
  acc: RetoolAccount,
  agentId: string,
  threadId: string,
  text: string,
)

Source from the content-addressed store, hash-verified

97 return data.id as string;
98}
99async function retoolSendMessage(
100 acc: RetoolAccount,
101 agentId: string,
102 threadId: string,
103 text: string,
104) {
105 const url =
106 `https://${acc.domain_name}/api/agents/${agentId}/threads/${threadId}/messages`;
107 const r = await fetch(url, {
108 method: "POST",
109 headers: {
110 "x-xsrf-token": acc.x_xsrf_token,
111 "Cookie": `accessToken=${acc.accessToken}`,
112 "Content-Type": "application/json",
113 },
114 body: JSON.stringify({ type: "text", text, timezone: "Asia/Shanghai" }),
115 });
116 if (!r.ok) throw new Error(`send ${r.status}`);
117 const data = await r.json();
118 return data.content.runId as string;
119}
120async function retoolGetMessage(
121 acc: RetoolAccount,
122 agentId: string,

Callers 1

fetchFunction · 0.70

Calls 1

fetchFunction · 0.85

Tested by

no test coverage detected