Skip to main content
Glama
jongall45

Frontrun MCP Server

by jongall45

frontrun_create_rule

Create custom classification rules to automatically tag entities based on bio keywords, sector, username patterns, or company status. Build watchlists, sector taxonomies, and track competitors.

Instructions

Create a custom classification rule. Rules auto-tag entities matching conditions (bio keywords, sector, username pattern). Use this to build custom watchlists, sector taxonomies, or competitor tracking.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYesHuman-readable rule name, e.g. "DeFi Protocols"
conditionsYesConditions that must ALL be met
actionsYesWhat to apply when conditions match

Implementation Reference

  • Handler function for frontrun_create_rule tool. Makes a POST API call to /classify/rules endpoint with name, conditions, and actions parameters. Returns JSON-formatted response.
    async ({ name, conditions, actions }) => {
      const result = await apiCall('POST', '/classify/rules', { name, conditions, actions });
      return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
    }
  • Zod schema defining input validation for frontrun_create_rule. Includes name (string), conditions object (bio_keywords, username_pattern, sector_contains, must_be_company), and actions object (custom_sector, custom_entity_type, tags, priority).
    {
      name: z.string().describe('Human-readable rule name, e.g. "DeFi Protocols"'),
      conditions: z.object({
        bio_keywords: z.array(z.string()).optional().describe('Keywords to match in bio (any match triggers)'),
        username_pattern: z.string().optional().describe('Regex pattern for username'),
        sector_contains: z.string().optional().describe('Match entities in this sector'),
        must_be_company: z.boolean().optional().describe('Only match companies (true) or individuals (false)'),
      }).describe('Conditions that must ALL be met'),
      actions: z.object({
        custom_sector: z.string().optional().describe('Override sector classification'),
        custom_entity_type: z.string().optional().describe('Override entity type'),
        tags: z.array(z.string()).optional().describe('Tags to apply, e.g. ["watchlist", "competitor"]'),
        priority: z.string().optional().describe('"high", "medium", or "low"'),
      }).describe('What to apply when conditions match'),
    },
  • index.js:239-261 (registration)
    Registration of frontrun_create_rule tool with MCP server. Defines tool name, description, schema, and handler function using server.tool() method.
    server.tool(
      'frontrun_create_rule',
      'Create a custom classification rule. Rules auto-tag entities matching conditions (bio keywords, sector, username pattern). Use this to build custom watchlists, sector taxonomies, or competitor tracking.',
      {
        name: z.string().describe('Human-readable rule name, e.g. "DeFi Protocols"'),
        conditions: z.object({
          bio_keywords: z.array(z.string()).optional().describe('Keywords to match in bio (any match triggers)'),
          username_pattern: z.string().optional().describe('Regex pattern for username'),
          sector_contains: z.string().optional().describe('Match entities in this sector'),
          must_be_company: z.boolean().optional().describe('Only match companies (true) or individuals (false)'),
        }).describe('Conditions that must ALL be met'),
        actions: z.object({
          custom_sector: z.string().optional().describe('Override sector classification'),
          custom_entity_type: z.string().optional().describe('Override entity type'),
          tags: z.array(z.string()).optional().describe('Tags to apply, e.g. ["watchlist", "competitor"]'),
          priority: z.string().optional().describe('"high", "medium", or "low"'),
        }).describe('What to apply when conditions match'),
      },
      async ({ name, conditions, actions }) => {
        const result = await apiCall('POST', '/classify/rules', { name, conditions, actions });
        return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
      }
    );
  • Helper function apiCall that handles HTTP requests to the Frontrun API. Includes timeout handling (60s), error handling for network issues, rate limiting (429), authentication (401), insufficient balance (402), and other HTTP errors. Constructs full URL, sets headers with API key, and serializes request body.
    async function apiCall(method, path, body = null) {
      const url = `${API_URL}/v1${path}`;
      const options = {
        method,
        headers: {
          'X-API-Key': API_KEY,
          'Content-Type': 'application/json',
        },
      };
      if (body) {
        options.body = JSON.stringify(body);
      }
    
      const controller = new AbortController();
      const timeout = setTimeout(() => controller.abort(), 60000);
      options.signal = controller.signal;
    
      let response;
      try {
        response = await fetch(url, options);
      } catch (err) {
        clearTimeout(timeout);
        if (err.name === 'AbortError') return { error: 'Request timed out (60s). Try a narrower query.' };
        return { error: `Network error: ${err.message}` };
      }
      clearTimeout(timeout);
    
      if (response.status === 429) {
        const retry = response.headers.get('Retry-After') || '60';
        return { error: `Rate limited. Retry in ${retry}s.` };
      }
      if (response.status === 401) {
        return { error: 'Invalid API key. Check FRONTRUN_API_KEY.' };
      }
      if (response.status === 402) {
        const data = await response.json();
        return { error: 'Insufficient balance', ...data };
      }
      if (!response.ok) {
        const text = await response.text();
        return { error: `HTTP ${response.status}: ${text.slice(0, 500)}` };
      }
    
      return response.json();
    }
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 mentions that rules 'auto-tag entities matching conditions,' implying a write operation, but lacks details on permissions, side effects (e.g., whether rules are applied immediately or require activation), error handling, or rate limits. For a creation tool with zero annotation coverage, this is a significant gap in transparency.

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, with the first sentence stating the core purpose and the second providing usage examples. Every sentence earns its place by adding value without redundancy, 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.

Completeness3/5

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

Given the tool's complexity (3 parameters with nested objects, no output schema, and no annotations), the description is adequate but has clear gaps. It covers purpose and usage well but lacks behavioral details (e.g., how rules are applied, error cases) and does not explain return values or side effects, which are important for a creation tool with no structured output information.

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 schema description coverage is 100%, so the schema already documents all parameters (name, conditions, actions) thoroughly. The description adds some context by mentioning 'bio keywords, sector, username pattern' and use cases like 'watchlists,' but this does not significantly enhance the parameter semantics beyond what the schema provides. Baseline 3 is appropriate when the schema does the heavy lifting.

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 ('create a custom classification rule') and resources ('auto-tag entities matching conditions'), and distinguishes it from siblings like frontrun_list_rules or frontrun_update_rule by focusing on creation rather than listing or updating. It explicitly mentions what the rule does (auto-tag entities) and provides concrete examples of use cases.

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 ('build custom watchlists, sector taxonomies, or competitor tracking'), which helps differentiate it from other tools like frontrun_classify or frontrun_tag. However, it does not explicitly state when not to use it or name specific alternatives (e.g., frontrun_update_rule for modifications), 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/jongall45/frontrun-mcp-server'

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