Skip to main content
Glama
saralegui-solutions

MCP Self-Learning Server

predict_next_action

Predicts the next likely action based on context and previous actions to assist with task planning and workflow optimization.

Instructions

Predict the next likely action based on context

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
contextNo
previousActionsNo

Implementation Reference

  • Registration of the 'predict_next_action' tool in the MCP server's listTools handler, including name, description, and input schema definition.
    {
      name: 'predict_next_action',
      description: 'Predict the next likely action based on context',
      inputSchema: {
        type: 'object',
        properties: {
          context: { type: 'object' },
          previousActions: {
            type: 'array',
            items: { type: 'string' }
          }
        }
      }
    },
  • The core handler function for the 'predict_next_action' tool. It matches the provided previousActions against learned tool sequences in patterns, predicts the next action, sorts by confidence, and returns top 5 predictions.
    async handlePredictNextAction(args) {
      const { context, previousActions = [] } = args;
      const predictions = [];
      
      // Find matching patterns
      for (const [key, pattern] of this.learningEngine.patterns) {
        const sequence = pattern.features?.toolSequence || [];
        
        // Check if previous actions match pattern prefix
        if (this.sequenceMatches(previousActions, sequence)) {
          if (sequence.length > previousActions.length) {
            predictions.push({
              action: sequence[previousActions.length],
              confidence: pattern.confidence,
              pattern: key
            });
          }
        }
      }
      
      // Sort by confidence
      predictions.sort((a, b) => b.confidence - a.confidence);
      
      return {
        success: true,
        predictions: predictions.slice(0, 5),
        context: context
      };
    }
  • Helper method used by handlePredictNextAction to determine if the previous actions match the prefix of a learned tool sequence.
    sequenceMatches(actions, sequence) {
      if (actions.length > sequence.length) return false;
      
      for (let i = 0; i < actions.length; i++) {
        if (actions[i] !== sequence[i]) return false;
      }
      
      return true;
    }
Behavior1/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 but fails to do so. It does not explain whether this is a read-only or mutative operation, what permissions or authentication might be required, any rate limits, error handling, or what the output format looks like (e.g., a prediction score, a list of actions). This lack of information makes it difficult for an agent to understand how to invoke or interpret results from the tool.

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 extremely concise with a single sentence: 'Predict the next likely action based on context'. It is front-loaded and wastes no words, making it easy to parse quickly. However, this conciseness comes at the cost of completeness, as noted in other dimensions.

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

Completeness1/5

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

Given the complexity implied by 2 parameters (including a nested object), no annotations, no output schema, and 0% schema description coverage, the description is severely incomplete. It does not provide enough information for an agent to reliably select, invoke, or interpret this tool, especially compared to more detailed sibling tools. The lack of output details or behavioral context makes it inadequate for practical use.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters1/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 2 parameters with 0% description coverage, meaning the schema provides no details about 'context' (an object) or 'previousActions' (an array of strings). The description does not compensate by explaining what these parameters represent, their expected formats, or examples of valid inputs. This leaves the agent guessing about how to structure the input data effectively.

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

Purpose2/5

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

The description 'Predict the next likely action based on context' is a tautology that essentially restates the tool name 'predict_next_action' with minimal elaboration. It specifies the verb 'predict' and mentions 'next likely action' and 'context', but lacks specificity about what domain or type of actions it predicts, and does not distinguish it from sibling tools like 'analyze_pattern' or 'get_insights', which might also involve prediction or analysis.

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 does not mention any prerequisites, constraints, or specific scenarios for its application, nor does it reference sibling tools like 'analyze_pattern' or 'get_insights' that might serve similar purposes. This leaves the agent without clear direction on appropriate usage contexts.

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/saralegui-solutions/mcp-self-learning-server'

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