Skip to main content
Glama

Search SEI CERT rules by keyword

search_rules
Read-onlyIdempotent

Rank SEI CERT C/C++ rules by keyword relevance to a free-text query of API names, concepts, or rule IDs when you know what the code does but not which rule applies.

Instructions

Rank SEI CERT C/C++ rules by keyword relevance to a free-text query: API names (strcpy, malloc, pthread_mutex_lock), concepts (integer overflow) or a rule ID. Use when you know what the code does but not which rule applies. Do not use for structured filters (use list_rules) or to read a rule (use get_rule). Matching is case-insensitive term counting over titles, rule text and examples, not semantic search; 1-character tokens are ignored and a query with no usable token returns an empty list. Reads bundled data only; fast.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "query": "<query>"
    },
    "name": "search_rules"
  }
}

Input Schema

NameRequiredDescriptionDefault
langNoRestrict to SEI CERT C (c) or C++ (cpp).any
limitNoMaximum results.
queryYesKeywords separated by spaces; title hits weigh 8x body hits.

Output Schema

NameRequiredDescriptionDefault
queryYesThe query as received.
resultsYesBest match first. Same summary fields as list_rules (without coverage) plus `score`.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed12 schema fields changedv0.1.2
    • removedInput schema / properties / lang / anyOf
      Removed value: -[
      -  {
      -    "type": "string"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]
    • changedInput schema / properties / lang / default
      Previous value: -nullNew value: +"any"
    • addedInput schema / properties / lang / description
      Added value: +"Restrict to SEI CERT C (c) or C++ (cpp)."
    • addedInput schema / properties / lang / enum
      Added value: +[
      +  "any",
      +  "c",
      +  "cpp"
      +]
    • addedInput schema / properties / lang / type
      Added value: +"string"
    • addedInput schema / properties / limit / description
      Added value: +"Maximum results."
    • addedInput schema / properties / limit / maximum
      Added value: +50
    • addedInput schema / properties / limit / minimum
      Added value: +1
    • addedInput schema / properties / query / description
      Added value: +"Keywords separated by spaces; title hits weigh 8x body hits."
    • addedInput schema / properties / query / examples
      Added value: +[
      +  "strcpy buffer",
      +  "signal handler",
      +  "EXP34-C"
      +]
    • addedInput schema / properties / query / minLength
      Added value: +2
    • changedOutput schema / (root)
      Previous value: -nullNew value: +{
      +  "additionalProperties": true,
      +  "properties": {
      +    "query": {
      +      "description": "The query as received.",
      +      "title": "Query",
      +      "type": "string"
      +    },
      +    "results": {
      +      "description": "Best match first. Same summary fields as list_rules (without coverage) plus `score`.",
      +      "items": {
      +        "additionalProperties": true,
      +        "type": "object"
      +      },
      +      "title": "Results",
      +      "type": "array"
      +    }
      +  },
      +  "required": [
      +    "query",
      +    "results"
      +  ],
      +  "title": "SearchResult",
      +  "type": "object"
      +}
  2. First observedv0.1.0

TDQS

A4.6/5.0
Behavior4/5

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

Annotations already declare read-only, idempotent, closed-world behavior, yet the description adds substantial detail beyond them: matching is case-insensitive term counting, not semantic search; 1-character tokens are ignored; token-less queries return an empty list; and data is bundled and fast. What's missing is ranking tie-breaking or result shape, but that is minor given the output schema exists.

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?

Dense but front-loaded: purpose, then query examples, then use/exclusion guidance, then matching semantics and edge cases. Every sentence carries information, and no wording is redundant.

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 keyword search tool with full schema coverage, annotations, and an output schema, the description covers purpose, exclusions, matching behavior, and edge-case returns. Only minor gaps remain, such as how ties are broken or ordering guarantees beyond relevance.

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

Parameters4/5

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

Schema coverage is 100%, so baseline is 3; the description adds real meaning by explaining what query tokens match against (titles, rule text, examples) and noting title hits weigh 8x body hits. It does not expand on lang or limit, but the schema already documents those adequately.

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?

States a specific verb+resource (rank SEI CERT C/C++ rules by keyword relevance) and gives concrete query examples (API names, concepts, rule IDs). It explicitly distinguishes itself from list_rules and get_rule, so an agent can select it without opening sibling schemas.

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?

Explicit when-to-use ('when you know what the code does but not which rule applies') plus explicit when-not ('Do not use for structured filters (use list_rules) or to read a rule (use get_rule)'), naming alternatives. Routing guidance is complete.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.