Skip to main content
Glama

Clear Conversations

clear_conversations
DestructiveIdempotent

Clear all conversation history to start fresh and reset the context for new queries.

Instructions

Clear all conversation history and start fresh

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The main handler function for the clear_conversations tool. It calls conversationManager.clearAll() and returns a formatted result message.
    export function clearConversationsTool(
      conversationManager: ConversationManager,
      _args: Record<string, unknown>
    ) {
      const result = conversationManager.clearAll();
    
      logger.info(`User cleared ${result.conversationsCleared} conversations`);
    
      const message =
        result.conversationsCleared === 0
          ? '🧹 No conversations to clear - memory is already empty!'
          : `🧹 Cleared ${result.conversationsCleared} conversation${result.conversationsCleared === 1 ? '' : 's'} (${result.messagesCleared} message${result.messagesCleared === 1 ? '' : 's'})`;
    
      return {
        content: [
          {
            type: 'text',
            text: `${message}\n\nšŸ¦† All ducks now have a fresh start! Previous conversation context has been removed.`,
          },
        ],
      };
    }
  • Helper method on ConversationManager that clears all conversations and returns counts of what was cleared.
    clearAll(): { conversationsCleared: number; messagesCleared: number } {
      let totalMessages = 0;
    
      // Count total messages across all conversations
      for (const conversation of this.conversations.values()) {
        totalMessages += conversation.messages.length;
      }
    
      const conversationsCleared = this.conversations.size;
      this.conversations.clear();
    
      logger.info(
        `Cleared ${conversationsCleared} conversations with ${totalMessages} total messages`
      );
    
      return {
        conversationsCleared,
        messagesCleared: totalMessages,
      };
    }
  • src/server.ts:319-338 (registration)
    Registration of the clear_conversations tool with the MCP server, including schema metadata and the handler wrapper.
    // clear_conversations
    this.server.registerTool(
      'clear_conversations',
      {
        title: 'Clear Conversations',
        description: 'Clear all conversation history and start fresh',
        annotations: {
          destructiveHint: true,
          idempotentHint: true,
          openWorldHint: false,
        },
      },
      () => {
        try {
          return this.toolResult(clearConversationsTool(this.conversationManager, {}));
        } catch (error) {
          return this.toolErrorResult(error);
        }
      }
    );
Behavior3/5

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

Annotations already provide destructiveHint: true, idempotentHint: true, and openWorldHint: false. The description aligns with these (clear = destructive) but adds no new behavioral context beyond what annotations offer, such as permission requirements or side effects.

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, front-loaded sentence with no waste. Every word earns its place, making it efficient and easy to parse.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a zero-parameter, no-output-schema tool with clear annotations, the description completely covers the tool's purpose. No additional context is necessary.

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?

The input schema has zero parameters with 100% coverage, so baseline is 3. The description adds no parameter information, which is fine as none exist.

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

Purpose5/5

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

The description 'Clear all conversation history and start fresh' provides a specific verb and resource, clearly stating the tool's action. It distinguishes itself from siblings like chat_with_duck or list_ducks by being the only tool dedicated to clearing conversations.

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 offers no guidance on when to use this tool versus alternatives. It does not mention prerequisites, consequences, or scenarios where clearing is appropriate, leaving the agent without context for 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

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/nesquikm/mcp-rubber-duck'

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