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

Function retoolSendMessage

retool.ts:116–136  ·  view source on GitHub ↗
(
  acc: RetoolAccount,
  agentId: string,
  threadId: string,
  text: string,
)

Source from the content-addressed store, hash-verified

114 return data.id as string;
115}
116async function retoolSendMessage(
117 acc: RetoolAccount,
118 agentId: string,
119 threadId: string,
120 text: string,
121) {
122 const url =
123 `https://${acc.domain_name}/api/agents/${agentId}/threads/${threadId}/messages`;
124 const resp = await fetch(url, {
125 method: "POST",
126 headers: {
127 "x-xsrf-token": acc.x_xsrf_token,
128 "Cookie": `accessToken=${acc.accessToken}`,
129 "Content-Type": "application/json",
130 },
131 body: JSON.stringify({ type: "text", text, timezone: "Asia/Shanghai" }),
132 });
133 if (!resp.ok) throw new Error(`send message failed ${resp.status}`);
134 const data = await resp.json();
135 return data.content.runId as string;
136}
137async function retoolGetMessage(
138 acc: RetoolAccount,
139 agentId: string,

Callers 1

handleRequestFunction · 0.70

Calls 1

fetchFunction · 0.85

Tested by

no test coverage detected