Skip to main content
Glama
gleanwork

Glean MCP Server

by gleanwork

chat

Engage with Glean Assistant to retrieve enterprise knowledge, including company policies and time-off details, by providing user questions and optional message context for accurate responses.

Instructions

Chat with Glean Assistant using Glean's RAG

    Example request:

    {
        "message": "What are the company holidays this year?",
        "context": [
            "Hello, I need some information about time off.",
            "I'm planning my vacation for next year."
        ]
    }
    

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
contextNoOptional previous messages for context. Will be included in order before the current message.
messageYesThe user question or message to send to Glean Assistant.

Implementation Reference

  • The core handler function for the 'chat' tool. Converts simplified input parameters to Glean API format using convertToAPIChatRequest, validates, obtains the Glean client, and creates the chat session.
    export async function chat(params: ToolChatRequest) {
      const mappedParams = convertToAPIChatRequest(params);
      const parsedParams = ChatRequestSchema.parse(mappedParams) as ChatRequest;
      const client = await getClient();
    
      return await client.chat.create(parsedParams);
    }
  • Zod input schema for the 'chat' tool, defining 'message' (required string) and optional 'context' array of previous messages.
    export const ToolChatSchema = z.object({
      message: z
        .string()
        .describe('The user question or message to send to Glean Assistant.'),
    
      context: z
        .array(z.string())
        .describe(
          'Optional previous messages for context. Will be included in order before the current message.',
        )
        .optional(),
    });
  • Registers the 'chat' tool in the MCP listTools handler, providing name, description, and input schema reference.
    {
      name: TOOL_NAMES.chat,
      description: `Chat with Glean Assistant using Glean's RAG
    
      Example request:
    
      {
          "message": "What are the company holidays this year?",
          "context": [
              "Hello, I need some information about time off.",
              "I'm planning my vacation for next year."
          ]
      }
      `,
      inputSchema: z.toJSONSchema(chat.ToolChatSchema),
    },
    {
  • MCP callTool handler dispatch for 'chat': parses arguments with schema, invokes chat handler, formats response, and returns MCP content.
    case TOOL_NAMES.chat: {
      const args = chat.ToolChatSchema.parse(request.params.arguments);
      const result = await chat.chat(args);
      const formattedResults = chat.formatResponse(result);
    
      return {
        content: [{ type: 'text', text: formattedResults }],
        isError: false,
      };
    }
  • Helper function that maps the simplified ToolChatRequest to the full Glean ChatRequest format expected by the API.
    function convertToAPIChatRequest(input: ToolChatRequest) {
      const { message, context = [] } = input;
    
      const messages = [
        ...context.map((text) => ({
          author: Author.User,
          messageType: MessageType.Content,
          fragments: [{ text }],
        })),
    
        {
          author: Author.User,
          messageType: MessageType.Content,
          fragments: [{ text: message }],
        },
      ];
    
      const chatRequest: ChatRequest = {
        messages,
      };
    
      return chatRequest;
    }
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 only states the basic action ('Chat') and includes an example request, but doesn't cover critical aspects like authentication needs, rate limits, response format, or any side effects. This is inadequate for a tool with potential complexity in AI interactions.

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. The example request is relevant but could be more integrated; overall, it's efficient with minimal waste, though the formatting as a code block might slightly affect readability.

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 an AI chat tool with no annotations and no output schema, the description is incomplete. It doesn't explain what the tool returns, how errors are handled, or any behavioral traits, leaving significant gaps for the agent to understand the tool's full 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?

Schema description coverage is 100%, so the schema fully documents both parameters ('message' and 'context'). The description adds minimal value beyond the schema by showing an example request, but doesn't provide additional semantic context or usage nuances. This meets the baseline for high schema coverage.

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: 'Chat with Glean Assistant using Glean's RAG.' It specifies the verb ('Chat') and resource ('Glean Assistant'), but doesn't explicitly differentiate it from sibling tools like 'company_search' or 'people_profile_search', which are search-focused rather than conversational AI interactions.

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 lacks any mention of sibling tools or scenarios where this chat tool is preferred over search tools, leaving the agent without context for tool selection.

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