Skip to main content
Glama
yigitkonur

example-mcp-server-stdio

by yigitkonur

demo_progress

Demonstrates progress notifications with five sequential updates to show task completion status.

Instructions

Demonstrate progress notifications with 5 updates

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Output schema definition for the demo_progress tool, defining structured output with message and progressSteps array using Zod validation.
    const demoProgressOutputSchema = {
      message: z.string(),
      progressSteps: z.array(z.number()),
    };
  • src/server.ts:580-587 (registration)
    Registration of the demo_progress tool with server.registerTool, including empty input schema and reference to output schema.
    server.registerTool(
      'demo_progress',
      {
        title: 'Demo Progress',
        description: 'Demonstrate progress notifications with 5 updates',
        inputSchema: {},
        outputSchema: demoProgressOutputSchema,
      },
  • Handler function for demo_progress tool that simulates progress by sending 5 notifications with increasing progress (20%,40%,etc.) using sendNotification, then returns completion message with structured content.
      async (_, { sendNotification }) => {
        log.info('Executing demo_progress');
        requestCount++;
    
        const progressId = 'demo-progress-task';
    
        for (let i = 1; i <= 5; i++) {
          await new Promise((resolve) => setTimeout(resolve, 500));
          await sendNotification({
            method: 'notifications/progress',
            params: {
              progressToken: progressId,
              progress: i * 20,
              message: `Step ${i} of 5 - Processing complex calculations...`,
            },
          });
        }
    
        return {
          content: [
            {
              type: 'text',
              text: 'Progress demonstration completed',
            },
          ],
          structuredContent: {
            message: 'Progress demonstration completed',
            progressSteps: [20, 40, 60, 80, 100],
          },
        };
      },
    );

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/yigitkonur/example-mcp-server-stdio'

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