Skip to main content
Glama
merajmehrabi

Outlook Calendar MCP

by merajmehrabi

list_events

Retrieve calendar events within a specified date range from Microsoft Outlook using a local, privacy-focused solution. Input start date, optional end date, and calendar name to view event details.

Instructions

List calendar events within a specified date range

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
calendarNoCalendar name (optional)
endDateNoEnd date in MM/DD/YYYY format (optional)
startDateYesStart date in MM/DD/YYYY format

Implementation Reference

  • Handler for the list_events MCP tool. Calls listEvents wrapper and formats the output as MCP content with error handling.
    handler: async ({ startDate, endDate, calendar }) => {
      try {
        const events = await listEvents(startDate, endDate, calendar);
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify(events, null, 2)
            }
          ]
        };
      } catch (error) {
        return {
          content: [
            {
              type: 'text',
              text: `Error listing events: ${error.message}`
            }
          ],
          isError: true
        };
      }
    }
  • Input schema for the list_events tool defining required startDate/endDate and optional calendar.
    inputSchema: {
      type: 'object',
      properties: {
        startDate: {
          type: 'string',
          description: 'Start date in MM/DD/YYYY format'
        },
        endDate: {
          type: 'string',
          description: 'End date in MM/DD/YYYY format'
        },
        calendar: {
          type: 'string',
          description: 'Calendar name (optional)'
        }
      },
      required: ['startDate', 'endDate']
    },
  • src/index.js:66-96 (registration)
    Registration of tool call handler in MCP server. Dispatches to specific tool handler based on name, including the list_events tool.
      this.server.setRequestHandler(CallToolRequestSchema, async (request) => {
        const { name, arguments: args } = request.params;
        
        // Find the requested tool
        const tool = this.tools[name];
        
        if (!tool) {
          throw new McpError(
            ErrorCode.MethodNotFound,
            `Tool not found: ${name}`
          );
        }
        
        try {
          // Call the tool handler
          return await tool.handler(args);
        } catch (error) {
          console.error(`Error executing tool ${name}:`, error);
          
          return {
            content: [
              {
                type: 'text',
                text: `Error executing tool ${name}: ${error.message}`,
              },
            ],
            isError: true,
          };
        }
      });
    }
  • Helper wrapper function listEvents that invokes executeScript on the listEvents.vbs script.
    export async function listEvents(startDate, endDate, calendar) {
      return executeScript('listEvents', { startDate, endDate, calendar });
    }
  • Core helper function executeScript that runs VBScript files via child_process.exec and parses JSON output.
    export async function executeScript(scriptName, params = {}) {
      return new Promise((resolve, reject) => {
        // Build the command with UTF-8 support
        const scriptPath = path.join(SCRIPTS_DIR, `${scriptName}.vbs`);
        let command = `chcp 65001 >nul 2>&1 && cscript //NoLogo "${scriptPath}"`;
        
        // Add parameters
        for (const [key, value] of Object.entries(params)) {
          if (value !== undefined && value !== null && value !== '') {
            // Handle special characters in values
            const escapedValue = value.toString().replace(/"/g, '\\"');
            command += ` /${key}:"${escapedValue}"`;
          }
        }
        
        // Execute the command with UTF-8 encoding
        exec(command, { encoding: 'utf8' }, (error, stdout, stderr) => {
          // Check for execution errors
          if (error && !stdout.includes(SUCCESS_PREFIX)) {
            return reject(new Error(`Script execution failed: ${error.message}`));
          }
          
          // Check for script errors
          if (stdout.includes(ERROR_PREFIX)) {
            const errorMessage = stdout.substring(stdout.indexOf(ERROR_PREFIX) + ERROR_PREFIX.length).trim();
            return reject(new Error(`Script error: ${errorMessage}`));
          }
          
          // Process successful output
          if (stdout.includes(SUCCESS_PREFIX)) {
            try {
              const jsonStr = stdout.substring(stdout.indexOf(SUCCESS_PREFIX) + SUCCESS_PREFIX.length).trim();
              const result = JSON.parse(jsonStr);
              return resolve(result);
            } catch (parseError) {
              return reject(new Error(`Failed to parse script output: ${parseError.message}`));
            }
          }
          
          // If we get here, something unexpected happened
          reject(new Error(`Unexpected script output: ${stdout}`));
        });
      });
    }
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the basic action but lacks critical details: it doesn't mention whether this requires authentication, how results are returned (e.g., pagination, format), rate limits, or what happens if parameters are omitted. For a read tool with zero annotation coverage, this is insufficient.

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

Conciseness5/5

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

The description is a single, efficient sentence that front-loads the core purpose without any wasted words. It's appropriately sized for a straightforward list operation, making it easy for an agent to parse quickly.

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 tool's moderate complexity (3 parameters, no output schema, no annotations), the description is incomplete. It lacks information on authentication needs, result format, pagination, error handling, or how it differs from siblings like 'find_free_slots'. Without annotations or output schema, the description should provide more context for effective use.

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?

Schema description coverage is 100%, so the schema fully documents all three parameters (calendar, endDate, startDate) with their types, optionality, and format. The description adds no additional parameter semantics beyond implying date-range filtering, which is already covered in the schema. Baseline 3 is appropriate when the schema does the heavy lifting.

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

Purpose4/5

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

The description clearly states the verb ('List') and resource ('calendar events') with scope ('within a specified date range'). It distinguishes from siblings like 'create_event' or 'delete_event' by indicating a read operation, but doesn't explicitly differentiate from similar read tools like 'find_free_slots' or 'get_attendee_status'.

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 like 'find_free_slots' or 'get_calendars'. It mentions a date range but doesn't specify when this is preferable over other event-related tools, leaving the agent to infer usage context.

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

Related 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/merajmehrabi/Outlook_Calendar_MCP'

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