Skip to main content
Glama

get-hmr-events

Retrieve recent Hot Module Replacement events from Vite Dev server to monitor live code updates and modifications in real-time.

Instructions

Retrieves recent HMR events

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNoMaximum number of events to return

Implementation Reference

  • Complete registration block for the 'get-hmr-events' tool, defining its name, description, input schema, and the handler function that returns recent HMR events.
    server.tool(
      'get-hmr-events',
      'Retrieves recent HMR events',
      {
        limit: z.number().optional().describe('Maximum number of events to return')
      },
      async ({ limit }) => {
        try {
          const eventsToReturn = limit ? lastHMREvents.slice(0, limit) : lastHMREvents;
    
          return {
            content: [
              {
                type: 'text',
                text: eventsToReturn.length > 0
                  ? `Recent HMR events:\n${JSON.stringify(eventsToReturn, null, 2)}`
                  : 'No HMR events detected yet.'
              }
            ]
          };
        } catch (error) {
          const errorMessage = error instanceof Error ? error.message : String(error);
          Logger.error(`Failed to get HMR events: ${errorMessage}`);
          return {
            content: [
              {
                type: 'text',
                text: `Failed to get HMR events: ${errorMessage}`
              }
            ],
            isError: true
          };
        }
      }
    );
  • src/index.ts:85-85 (registration)
    Call to register HMR tools on the MCP server, providing the shared events array.
    registerHMRTools(server, lastHMREvents);
  • Shared mutable array storing recent HMR events, used by the tool handler.
    const lastHMREvents: HMREvent[] = [];
  • Type definition for HMR events, typing the events array used and returned by the tool.
    export type HMREvent = HMRUpdate | HMRError | HMRBrowserError | { type: string; [key: string]: unknown };
  • Zod input schema defining the optional 'limit' parameter for the number of events to retrieve.
    {
      limit: z.number().optional().describe('Maximum number of events to return')
    },
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries full burden. It states 'retrieves' which implies a read operation, but doesn't disclose behavioral traits like whether it requires specific permissions, how 'recent' is defined (e.g., time window), if there are rate limits, or what the response format looks like. This leaves significant gaps for an agent.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is extremely concise with just three words, which is efficient and front-loaded. However, it's arguably too brief given the lack of context about HMR events and behavioral details, slightly reducing its effectiveness.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity (HMR events likely relate to browser or development monitoring), no annotations, no output schema, and minimal description, this is incomplete. The description doesn't explain what HMR events are, their format, or how they relate to sibling tools, leaving the agent with insufficient context.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description adds no parameter semantics beyond what the schema provides. With 100% schema description coverage (the 'limit' parameter is fully documented in the schema), the baseline is 3. The description doesn't mention the 'limit' parameter or provide additional context about its usage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description 'Retrieves recent HMR events' clearly states the action (retrieves) and resource (HMR events), but it's vague about what HMR events are and doesn't distinguish from sibling tools. While it specifies 'recent' events, this is still somewhat ambiguous without temporal context.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. With sibling tools like 'get-console-logs' and 'monitor-network' that might overlap in monitoring browser activity, there's no indication of when this specific HMR event retrieval is appropriate or what distinguishes it.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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/ESnark/blowback'

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