Skip to main content
Glama

store_instinct

Add new behavior rules to the MCP Context Provider for persistent automation across chat sessions. Stores rules with trigger patterns and tags for automatic application.

Instructions

Store a new instinct candidate. Created as inactive with auto approval — use approve_instinct for human approval.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesUnique kebab-case ID (e.g. "git-conventional-commits")
ruleYesThe instinct rule text (20-80 tokens)
domainYesKnowledge domain (e.g. "git", "typescript", "docker")
tagsYesTags for matching and categorization
trigger_patternsYesRegex patterns that trigger this instinct
confidenceNoInitial confidence 0.0-1.0 (default 0.6)
filenameNoTarget YAML file (default "learned.instincts.yaml")

Implementation Reference

  • The tool 'store_instinct' is implemented within the switch statement of the 'CallToolRequestSchema' handler in 'src/server/index.ts'. It uses 'InstinctLoader' to load/save instinct configurations.
    case 'store_instinct': {
      const id = String(args?.['id'] ?? '');
      const rule = String(args?.['rule'] ?? '');
      const domain = String(args?.['domain'] ?? '');
      const tags = (args?.['tags'] as string[]) ?? [];
      const trigger_patterns = (args?.['trigger_patterns'] as string[]) ?? [];
      const confidence = Number(args?.['confidence'] ?? 0.6);
      const filename = String(args?.['filename'] ?? 'learned.instincts.yaml');
    
      if (!id || !rule || !domain) {
        return { content: [{ type: 'text', text: 'Error: id, rule, and domain are required' }] };
      }
    
      const loader = new InstinctLoader(resolve(INSTINCTS_PATH));
      let instinctFile: InstinctFile;
      try {
        instinctFile = await loader.load(filename);
      } catch {
        instinctFile = { version: '1.0', instincts: {} };
      }
    
      if (instinctFile.instincts[id]) {
        return { content: [{ type: 'text', text: `Error: instinct "${id}" already exists` }] };
      }
    
      const now = new Date().toISOString();
      instinctFile.instincts[id] = {
        id,
        rule,
        domain,
        tags,
        trigger_patterns,
        confidence,
        min_confidence: 0.5,
        usage_count: 0,
        approved_by: 'auto',
        outcome_log: [],
        active: false,
        created_at: now,
        updated_at: now,
      };
    
      await loader.save(filename, instinctFile);
      return {
        content: [{ type: 'text', text: JSON.stringify({ stored: id, file: filename, status: 'inactive — use approve_instinct to activate' }, null, 2) }],
      };
    }
  • Registration of the 'store_instinct' tool within the 'ListToolsRequestSchema' handler, defining its input schema and description.
      name: 'store_instinct',
      description:
        'Store a new instinct candidate. Created as inactive with auto approval — use approve_instinct for human approval.',
      inputSchema: {
        type: 'object' as const,
        properties: {
          id: { type: 'string', description: 'Unique kebab-case ID (e.g. "git-conventional-commits")' },
          rule: { type: 'string', description: 'The instinct rule text (20-80 tokens)' },
          domain: { type: 'string', description: 'Knowledge domain (e.g. "git", "typescript", "docker")' },
          tags: {
            type: 'array',
            items: { type: 'string' },
            description: 'Tags for matching and categorization',
          },
          trigger_patterns: {
            type: 'array',
            items: { type: 'string' },
            description: 'Regex patterns that trigger this instinct',
          },
          confidence: { type: 'number', description: 'Initial confidence 0.0-1.0 (default 0.6)' },
          filename: { type: 'string', description: 'Target YAML file (default "learned.instincts.yaml")' },
        },
        required: ['id', 'rule', 'domain', 'tags', 'trigger_patterns'],
      },
    },
Behavior4/5

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

With no annotations provided, the description carries the full burden and successfully discloses that created instincts start as 'inactive' with 'auto approval', explaining the entity lifecycle. It could be improved by mentioning return values or conflict behavior (e.g., duplicate IDs).

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?

Two sentences with zero waste: the first states the action, the second explains the state/workflow. Every word earns its place and critical info is front-loaded.

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?

For a 7-parameter tool with no output schema, the description adequately covers the storage workflow and state management. It could be improved by mentioning what happens if the ID already exists or what the tool returns.

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 all 7 parameters. The description does not add param-specific semantics, which is acceptable given the schema completeness (baseline 3).

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 uses a specific verb ('Store') and resource ('instinct candidate'), and clearly distinguishes this tool from its sibling 'approve_instinct' by explaining the inactive state and approval workflow.

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

Usage Guidelines5/5

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

Explicitly references the sibling tool 'approve_instinct' for the next step in the workflow ('use approve_instinct for human approval'), providing clear guidance on when to use each tool in the lifecycle.

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/doobidoo/MCP-Context-Provider'

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