Skip to main content
Glama

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
NameRequiredDescriptionDefault
urlYesURL to poll
intervalNoPoll interval in seconds (default: 30)
expectNo
action_idNoLink events to an agent action

Implementation Reference

  • 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();
  • 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' },

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/jarvisassistantux/loopsense'

If you have feedback or need assistance with the MCP directory API, please join our Discord server