Skip to main content
Glama

Review Your Conversation with Another Model

conversation_history

Review previous conversations with AI models to understand context, check past responses, and prepare for continuing discussions.

Instructions

See what you've already discussed with a specific model. Useful for understanding context before continuing a conversation, reviewing advice you got, or checking previous responses. Long conversations are automatically shortened to save context.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
conversationIdYesThe ID of the conversation you want to review. Get this from the response of the chat tool when you first talk to a model.

Implementation Reference

  • The handler function for the 'conversation_history' tool. It retrieves the conversation state and history using ConversationManager and returns them as a JSON string in the MCP response format.
    async ({ conversationId }) => {
      try {
        const conversation = conversationManager.getConversationState(conversationId);
        if (!conversation) {
          return {
            content: [
              {
                type: "text" as const,
                text: `Error: Conversation not found: ${conversationId}`,
              },
            ],
          };
        }
    
        const history = conversationManager.getHistory(conversationId);
    
        logger.debug("Retrieved conversation history", {
          conversationId,
          messageCount: history.length,
        });
    
        return {
          content: [
            {
              type: "text" as const,
              text: JSON.stringify({
                conversationId,
                modelId: conversation.modelId,
                messages: history,
              }),
            },
          ],
        };
      } catch (error) {
        const errorMessage = error instanceof Error ? error.message : String(error);
        logger.error(
          "Conversation history tool error",
          error instanceof Error ? error : new Error(errorMessage)
        );
    
        return {
          content: [
            {
              type: "text" as const,
              text: `Error: ${errorMessage}`,
            },
          ],
        };
      }
    }
  • Registration of the 'conversation_history' tool on the MCP server, including title, description, input schema (Zod), and reference to the handler function.
    server.registerTool(
      "conversation_history",
      {
        title: "Review Your Conversation with Another Model",
        description:
          "See what you've already discussed with a specific model. Useful for understanding context before continuing a conversation, reviewing advice you got, or checking previous responses. Long conversations are automatically shortened to save context.",
        inputSchema: z.object({
          conversationId: z
            .string()
            .describe(
              "The ID of the conversation you want to review. Get this from the response of the chat tool when you first talk to a model."
            ),
        }),
      },
      async ({ conversationId }) => {
        try {
          const conversation = conversationManager.getConversationState(conversationId);
          if (!conversation) {
            return {
              content: [
                {
                  type: "text" as const,
                  text: `Error: Conversation not found: ${conversationId}`,
                },
              ],
            };
          }
    
          const history = conversationManager.getHistory(conversationId);
    
          logger.debug("Retrieved conversation history", {
            conversationId,
            messageCount: history.length,
          });
    
          return {
            content: [
              {
                type: "text" as const,
                text: JSON.stringify({
                  conversationId,
                  modelId: conversation.modelId,
                  messages: history,
                }),
              },
            ],
          };
        } catch (error) {
          const errorMessage = error instanceof Error ? error.message : String(error);
          logger.error(
            "Conversation history tool error",
            error instanceof Error ? error : new Error(errorMessage)
          );
    
          return {
            content: [
              {
                type: "text" as const,
                text: `Error: ${errorMessage}`,
              },
            ],
          };
        }
      }
    );
  • TypeScript interface defining the structure of the conversation history response, matching the JSON returned by the handler.
    export interface ConversationHistoryResponse {
      conversationId: string;
      modelId: string;
      messages: ChatMessage[];
    }
  • Helper method in ConversationManager that retrieves and truncates the message history for a given conversation ID. Used by the tool handler.
    getHistory(conversationId: string): ChatMessage[] {
      const conversation = this.conversations.get(conversationId);
      if (!conversation) {
        throw new Error(`Conversation not found: ${conversationId}`);
      }
    
      return this.truncateMessages(conversation.messages);
    }
  • Helper method in ConversationManager that gets the full conversation state (including modelId) for a given conversation ID. Used by the tool handler.
    getConversationState(conversationId: string): ConversationState | null {
      return this.getConversation(conversationId);
    }
Behavior4/5

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

Since no annotations are provided, the description carries the full burden of behavioral disclosure. It effectively describes key behavioral traits: it's a read-only operation (implied by 'see', 'review', 'check'), it requires a specific conversation ID, and it mentions automatic shortening of long conversations to save context. This covers the essential behavior without contradictions, though it could add more about response format or limitations.

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 appropriately sized and front-loaded: the first sentence states the core purpose, followed by usage contexts and a behavioral note about automatic shortening. Every sentence adds value without redundancy, making it efficient and easy to parse for an AI agent.

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

Completeness4/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 (single parameter, read-only operation), no annotations, and no output schema, the description is mostly complete. It covers purpose, usage, and a key behavioral trait (automatic shortening). However, it lacks details on output format (e.g., what the review returns) and potential error cases, which would enhance completeness for an agent.

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 100% description coverage, with the single parameter 'conversationId' well-documented in the schema. The description doesn't add any additional parameter semantics beyond what's in the schema (e.g., it doesn't explain format examples or validation rules). With high schema coverage, the baseline score of 3 is appropriate as the description doesn't compensate but also doesn't detract.

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 clearly states the tool's purpose with specific verbs ('see', 'review', 'check') and resources ('what you've already discussed', 'conversation with a specific model'). It distinguishes from sibling tools like 'chat' (which initiates conversations) and 'list_models' (which lists available models) by focusing on reviewing past conversations rather than creating new ones or listing options.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides clear context for when to use this tool ('useful for understanding context before continuing a conversation, reviewing advice you got, or checking previous responses'), which helps differentiate it from the 'chat' tool for new conversations. However, it doesn't explicitly state when NOT to use it or mention alternatives like checking conversation history through other means, which prevents a perfect score.

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/danielwpz/polybrain-mcp'

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