Skip to main content
Glama
gleanwork

Glean MCP Server

by gleanwork

people_profile_search

Locate individuals within your organization by searching profiles with specific filters like name, department, or location. Retrieve relevant results efficiently for targeted queries.

Instructions

Search for people profiles in the company

    Example request:

    {
        "query": "Find people named John Doe",
        "filters": {
            "department": "Engineering",
            "city": "San Francisco"
        },
        "pageSize": 10
    }

    

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
filtersNoAllowed facet fields: email, first_name, last_name, manager_email, department, title, location, city, country, state, region, business_unit, team, team_id, nickname, preferred_name, roletype, reportsto, startafter, startbefore, industry, has, from. Provide as { "facet": "value" }.
pageSizeNoHint to the server for how many people to return (1-100, default 10).
queryNoFree-text query to search people by name, title, etc.

Implementation Reference

  • The core handler function that performs the people profile search by mapping input parameters to Glean API request and calling the entities.list endpoint.
    export async function peopleProfileSearch(
      params: ToolPeopleProfileSearchRequest,
    ) {
      const mappedParams = convertToAPIEntitiesRequest(params);
      const parsedParams = ListEntitiesRequestSchema.parse(
        mappedParams,
      ) as ListEntitiesRequest;
      const client = await getClient();
    
      return await client.entities.list(parsedParams);
    }
  • Zod schema defining the input parameters for the people_profile_search tool, including query, filters, and pageSize with validation.
    export const ToolPeopleProfileSearchSchema = z
      .object({
        query: z
          .string()
          .describe('Free-text query to search people by name, title, etc.')
          .optional(),
    
        filters: z
          .record(z.string(), z.string())
          .refine(
            (val) =>
              Object.keys(val).every((key) =>
                PEOPLE_FACETS_VALUES.includes(key as any),
              ),
            {
              message:
                'Invalid filter key. Must be one of: ' +
                PEOPLE_FACETS_VALUES.join(', '),
            },
          )
          .describe(
            'Allowed facet fields: email, first_name, last_name, manager_email, department, title, location, city, country, state, region, business_unit, team, team_id, nickname, preferred_name, roletype, reportsto, startafter, startbefore, industry, has, from. Provide as { "facet": "value" }.',
          )
          .optional(),
    
        pageSize: z
          .number()
          .int()
          .min(1)
          .max(100)
          .describe(
            'Hint to the server for how many people to return (1-100, default 10).',
          )
          .optional(),
      })
      .refine(
        (val) => val.query || (val.filters && Object.keys(val.filters).length > 0),
        {
          message: 'At least one of "query" or "filters" must be provided.',
          path: [],
        },
      );
  • Registration and dispatch logic in the callToolHandler switch case that validates input, calls the handler, formats response, and returns MCP content.
    case TOOL_NAMES.peopleProfileSearch: {
      const args = peopleProfileSearch.ToolPeopleProfileSearchSchema.parse(
        request.params.arguments,
      );
      const result = await peopleProfileSearch.peopleProfileSearch(args);
      const formattedResults = peopleProfileSearch.formatResponse(result);
    
      return {
        content: [{ type: 'text', text: formattedResults }],
        isError: false,
      };
    }
  • Tool registration in listToolsHandler, providing name, description, and input schema for discovery.
    {
      name: TOOL_NAMES.peopleProfileSearch,
      description: `Search for people profiles in the company
    
      Example request:
    
      {
          "query": "Find people named John Doe",
          "filters": {
              "department": "Engineering",
              "city": "San Francisco"
          },
          "pageSize": 10
      }
    
      `,
      inputSchema: z.toJSONSchema(
        peopleProfileSearch.ToolPeopleProfileSearchSchema,
      ),
    },
  • Helper function to format raw Glean API search results into a readable text summary for MCP response.
    export function formatResponse(searchResults: any): string {
      if (
        !searchResults ||
        !Array.isArray(searchResults.results) ||
        searchResults.results.length === 0
      ) {
        return 'No matching people found.';
      }
    
      const formatted = searchResults.results
        .map((person: any, index: number) => {
          const metadata = person.metadata ?? {};
    
          const displayName = metadata.preferredName || person.name || 'Unnamed';
    
          const title = metadata.title || 'Unknown title';
    
          const department = metadata.department || 'Unknown department';
    
          const location =
            metadata.location ||
            metadata.structuredLocation?.city ||
            metadata.structuredLocation?.country ||
            'Unknown location';
    
          const email =
            metadata.email || metadata.aliasEmails?.[0] || 'Unknown email';
    
          // Show first team affiliation if present for additional context
          const primaryTeam =
            Array.isArray(metadata.teams) && metadata.teams.length > 0
              ? metadata.teams[0].name
              : undefined;
    
          const teamSuffix = primaryTeam ? ` [${primaryTeam}]` : '';
    
          return `${index + 1}. ${displayName} – ${title}${teamSuffix}, ${department} (${location}) • ${email}`;
        })
        .join('\n');
    
      const total =
        typeof searchResults.totalCount === 'number'
          ? searchResults.totalCount
          : searchResults.results.length;
    
      return `Found ${total} people:\n\n${formatted}`;
    }
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions searching but doesn't describe key traits like whether this is a read-only operation, pagination behavior beyond 'pageSize', rate limits, authentication needs, or what happens with large result sets. The example shows a request format but lacks operational context.

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 appropriately sized and front-loaded with the core purpose in the first sentence. The example request is relevant but could be more concise. Overall, it avoids unnecessary verbosity, though the example takes up space without adding significant guidance.

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 of a search tool with three parameters, no annotations, and no output schema, the description is incomplete. It lacks information on return values, error handling, and behavioral traits like pagination or rate limits. The example helps but doesn't compensate for the missing contextual details needed for effective tool 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 already documents all three parameters thoroughly. The description adds an example that illustrates usage but doesn't provide additional semantic meaning beyond what's in the schema descriptions. The example clarifies the structure of 'filters' as an object, but this is implied by the schema.

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 tool's purpose: 'Search for people profiles in the company.' It specifies the verb ('Search') and resource ('people profiles'), and distinguishes it from sibling tools like 'chat' and 'company_search' by focusing on people profiles rather than chat or company data. However, it doesn't explicitly differentiate from potential similar search tools beyond the resource scope.

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. It doesn't mention sibling tools like 'company_search' or explain scenarios where one might be preferred over the other. The example request is helpful for syntax but doesn't offer usage context or exclusions.

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/gleanwork/mcp-server'

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