MCPcopy Create free account
hub / github.com/cloudflare/agents-starter / executeTask

Method executeTask

src/server.ts:185–200  ·  view source on GitHub ↗
(description: string, _task: Schedule<string>)

Source from the content-addressed store, hash-verified

183 abortSignal: options?.abortSignal
184 });
185
186 return result.toUIMessageStreamResponse();
187 }
188
189 async executeTask(description: string, _task: Schedule<string>) {
190 // Do the actual work here (send email, call API, etc.)
191 console.log(`Executing scheduled task: ${description}`);
192
193 // Notify connected clients via a broadcast event.
194 // We use broadcast() instead of saveMessages() to avoid injecting
195 // into chat history — that would cause the AI to see the notification
196 // as new context and potentially loop.
197 this.broadcast(
198 JSON.stringify({
199 type: "scheduled-task",
200 description,
201 timestamp: new Date().toISOString()
202 })
203 );

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected