Skip to main content
Glama
anoopt

Outlook Meetings Scheduler MCP Server

find-person

Locate email addresses by entering a person's name to streamline adding attendees in Microsoft Outlook meeting scheduling using the Microsoft Graph API.

Instructions

Find a person's email address by their name

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYesName or partial name of the person to find

Implementation Reference

  • Registration of the 'find-person' tool using registerTool, including inline schema and handler.
      registerTool(
        server,
        "find-person",
        "Find a person's email address by their name",
        {
          name: z.string().describe("Name or partial name of the person to find"),
        },
        async ({ name }) => {
          const { graph, userEmail, authError } = await getGraphConfig();
    
          // Check for authentication errors
          if (authError) {
            return {
              content: [
                {
                  type: "text",
                  text: `๐Ÿ” Authentication Required\n\n${authError}\n\nPlease complete the authentication and try again.`,
                },
              ],
            };
          }
    
          // Search for the person by name
          const people = await graph.searchPeople(name, userEmail);
          
          if (!people) {
            return {
              content: [
                {
                  type: "text",
                  text: "Failed to search for people. Check the logs for details.",
                },
              ],
            };
          }
      
          if (people.length === 0) {
            return {
              content: [
                {
                  type: "text",
                  text: `No people found matching "${name}". Please provide the full email address.`,
                },
              ],
            };
          }
      
          // Format the results for response
          const peopleList = people.map((person: any, index: number) => {
            const email = person.mail || person.userPrincipalName || person.emailAddresses?.[0]?.address || "No email available";
            const displayName = person.displayName || "Unknown name";
            return `${index + 1}. ${displayName} (${email})`;
          }).join("\n");
          
          const successMessage = `
    Found ${people.length} people matching "${name}":
    
    ${peopleList}
    
    You can use these email addresses to create a calendar event.`;
      
          return {
            content: [
              {
                type: "text",
                text: successMessage,
              },
            ],
          };
        }
      );
  • Input schema for the 'find-person' tool using Zod.
    {
      name: z.string().describe("Name or partial name of the person to find"),
    },
  • Handler function for 'find-person' tool: authenticates, searches for people by name using graph API, formats results.
        async ({ name }) => {
          const { graph, userEmail, authError } = await getGraphConfig();
    
          // Check for authentication errors
          if (authError) {
            return {
              content: [
                {
                  type: "text",
                  text: `๐Ÿ” Authentication Required\n\n${authError}\n\nPlease complete the authentication and try again.`,
                },
              ],
            };
          }
    
          // Search for the person by name
          const people = await graph.searchPeople(name, userEmail);
          
          if (!people) {
            return {
              content: [
                {
                  type: "text",
                  text: "Failed to search for people. Check the logs for details.",
                },
              ],
            };
          }
      
          if (people.length === 0) {
            return {
              content: [
                {
                  type: "text",
                  text: `No people found matching "${name}". Please provide the full email address.`,
                },
              ],
            };
          }
      
          // Format the results for response
          const peopleList = people.map((person: any, index: number) => {
            const email = person.mail || person.userPrincipalName || person.emailAddresses?.[0]?.address || "No email available";
            const displayName = person.displayName || "Unknown name";
            return `${index + 1}. ${displayName} (${email})`;
          }).join("\n");
          
          const successMessage = `
    Found ${people.length} people matching "${name}":
    
    ${peopleList}
    
    You can use these email addresses to create a calendar event.`;
      
          return {
            content: [
              {
                type: "text",
                text: successMessage,
              },
            ],
          };
        }
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/anoopt/outlook-meetings-scheduler-mcp-server'

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