watch_url
Monitor HTTP endpoints for status or content changes by polling at configurable intervals. Detect modifications and trigger events when updates occur.
Instructions
Poll an HTTP endpoint and emit events when status or body changes
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| url | Yes | URL to poll | |
| interval | No | Poll interval in seconds (default: 30) | |
| expect | No | ||
| action_id | No | Link events to an agent action |
Implementation Reference
- src/server.ts:357-405 (handler)The handler implementation for the 'watch_url' MCP tool, which validates arguments, creates a watch record, stores it, and starts the watcher.
private async handleWatchUrl(args: Record<string, unknown>) { const schema = z.object({ url: z.string(), interval: z.number().optional(), method: z.string().optional(), expect: z.object({ status: z.number().optional(), body_contains: z.string().optional(), }).optional(), action_id: z.string().optional(), }); const parsed = schema.parse(args); const id = uuidv4(); const now = new Date().toISOString(); const config: HttpConfig = { kind: 'http', ...parsed }; const watch: WatchRecord = { id, kind: 'http', config, action_id: parsed.action_id ?? null, created_at: now, active: true, last_poll_at: null, }; insertWatch(watch); const watcher = new HttpWatcher(id, parsed.action_id ?? null, this.registry.getNotifyFn(), config); this.registry.register(watcher); return { content: [{ type: 'text' as const, text: JSON.stringify({ watch_id: id, status: 'polling', url: parsed.url }), }], }; } private async handleWatchWebhook(args: Record<string, unknown>) { const schema = z.object({ source_type: z.string(), port: z.number().optional(), filter: z.record(z.unknown()).optional(), action_id: z.string().optional(), }); const parsed = schema.parse(args); const id = uuidv4(); const now = new Date().toISOString(); - src/server.ts:358-367 (schema)The Zod schema used to validate the input arguments for the 'watch_url' tool.
const schema = z.object({ url: z.string(), interval: z.number().optional(), method: z.string().optional(), expect: z.object({ status: z.number().optional(), body_contains: z.string().optional(), }).optional(), action_id: z.string().optional(), }); - src/server.ts:99-104 (registration)The registration of the 'watch_url' tool within the MCP tool list.
name: 'watch_url', description: 'Poll an HTTP endpoint and emit events when status or body changes', inputSchema: { type: 'object', properties: { url: { type: 'string', description: 'URL to poll' },