Skip to main content
Glama

Validate algorithmic complexity

validate_complexity
Read-only

Estimate code time and space complexity via static loop analysis and comment annotations to identify performance bottlenecks before submission.

Instructions

Estimate time and space complexity of code through static loop analysis and comment annotations.

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": {
      "code": "<code>"
    },
    "name": "validate_complexity"
  }
}

Input Schema

NameRequiredDescriptionDefault
codeYesSource code to analyze
languageNoLanguage (cpp, python, java, etc.)

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.2

TDQS

B3.4/5.0
Behavior3/5

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

readOnlyHint=true already tells the agent this is a safe non-mutating operation. The description adds useful context that analysis is static (loops plus comment annotations) rather than empirical, implying no code execution, but it says nothing about accuracy limits or how results are derived when comments are absent.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

A single efficient sentence with no filler, leading with the verb and the core resource. Everything said carries information; only the missing return-value note keeps it from being exemplary.

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?

With no output schema, the description should say what the returned estimate looks like (e.g. complexity notation, confidence, per-function breakdown), and it does not. For a simple one-required-parameter read-only tool this is an understandable but real gap.

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 coverage is 100%, so both parameters are already documented in the schema. The description's mention of 'comment annotations' hints that inline comments influence the estimate, which adds some meaning beyond the schema, but it does not clarify the language parameter's expected values.

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

Purpose4/5

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

The description names a specific verb and resource: estimate time and space complexity of source code, plus the method used (static loop analysis and comment annotations). It is clear enough to distinguish from unrelated siblings like get_problem or generate_tests, though the name says 'validate' while the text says 'estimate', a minor verb mismatch an agent may notice.

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

Usage Guidelines3/5

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

The method phrase implies usage (static inspection of code without execution), but there is no explicit when-to-use guidance, no prerequisites, and no statement of when another tool would be preferable.

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