Skip to main content
Glama
Flux-Frontiers

SwiftKG MCP Server

rank_nodes

Identify the most structurally important code nodes by computing weighted CodeRank (PageRank) over the repository graph. Optionally persist scores for query-time reuse.

Instructions

Compute global weighted CodeRank (PageRank) over the repository graph.

Builds a directed weighted graph from the SQLite store and runs weighted PageRank to identify the most structurally important nodes. Relation weights follow the CodeRank defaults: CALLS=1.0, IMPORTS=0.9, INHERITS/CONFORMS/EXTENDS=0.75. Test paths are excluded by default.

Optionally persists the scores into the node_metrics table under the given metric name so they can be loaded at query time without recomputing.

:param top: Number of top-ranked nodes to return (default 25). :param rels: Comma-separated relations to include in the graph (default "CALLS,IMPORTS,INHERITS,CONFORMS,EXTENDS"). :param persist_metric: If non-empty, persist scores to node_metrics under this metric name (e.g. "coderank_global"). :param exclude_tests: Exclude test-path nodes from the graph (default True). :return: JSON array of ranked node dicts with node_id, score, top_pct (e.g. "top 0.5%"), kind, qualname, module_path, and rank fields.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
topNo
relsNoCALLS,IMPORTS,INHERITS,CONFORMS,EXTENDS
exclude_testsNo
persist_metricNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.3/5.0
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. It discloses the graph construction, default relation weights, test exclusion, and optional persistence behavior. It also explains the return fields. It does not mention side effects of persistence (e.g., overwriting existing metric names) or performance implications, but the disclosed behavior is substantial and transparent.

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?

The description is well-structured with a clear summary paragraph followed by parameter documentation. It is slightly verbose but every sentence adds value, including the algorithm details and persistence behavior. The front-loaded summary gives the agent the core purpose immediately.

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?

Given the tool's complexity (graph algorithm, multiple parameters, optional persistence, rich output), the description is quite complete. It covers inputs, defaults, behavior, and return schema. It lacks explicit notes on persistence side effects or performance, but the output schema and parameter docs cover most of what an agent needs to call it correctly.

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 description coverage is 0%, so the description must compensate. It does: each parameter (top, rels, persist_metric, exclude_tests) is explained with defaults and examples. The return format is also documented. The only minor gap is that 'rels' format is described as comma-separated but valid relation names are not enumerated beyond the default list.

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 computes global weighted CodeRank (PageRank) over the repository graph, with a specific verb ('Compute') and resource ('repository graph'). It distinguishes itself from siblings like centrality and bridge_centrality by specifying the weighted PageRank algorithm and default relation weights. The scope is precise and actionable.

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 explains when to use the tool: to identify structurally important nodes via weighted PageRank, and notes test paths are excluded by default. It does not explicitly name alternatives or when-not-to-use conditions, but the context is clear enough for an agent to select it over siblings like centrality or bridge_centrality. A small gap is the lack of explicit comparison to query_ranked or explain_rank, which are likely related.

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