Skip to main content
Glama
grafeo-mcp

grafeo-mcp

Official
by GrafeoDB

dijkstra

Read-only

Find the shortest weighted path between two graph nodes, returning distance, hop count, and path nodes; choose edge direction or weight property as needed.

Instructions

Shortest weighted path from source_id to target_id. Returns distance, hop_count and the path's nodes.

By default edges count in either direction, as "how are A and C connected" means; pass direction="outgoing" to follow edges only from source to target (a dependency or a flow).

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": {
      "source_id": "<source_id>",
      "target_id": "<target_id>"
    },
    "name": "dijkstra"
  }
}

Input Schema

NameRequiredDescriptionDefault
directionNo"both" (default) ignores edge direction; "outgoing" or "incoming" follow it.both
source_idYes
target_idYes
weight_propertyNoEdge property with a non-negative number; without it each edge weighs 1.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed10 schema fields changedv0.3.0
    • addedInput schema / properties / direction
      Added value: +{
      +  "default": "both",
      +  "description": "\"both\" (default) ignores edge direction; \"outgoing\" or \"incoming\" follow it.",
      +  "type": "string"
      +}
    • removedInput schema / properties / source_id / title
      Removed value: -"Source Id"
    • removedInput schema / properties / target_id / title
      Removed value: -"Target Id"
    • removedInput schema / properties / weight_property / anyOf
      Removed value: -[
      -  {
      -    "type": "string"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]
    • removedInput schema / properties / weight_property / default
      Removed value: -null
    • addedInput schema / properties / weight_property / description
      Added value: +"Edge property with a non-negative number; without it each edge weighs 1."
    • removedInput schema / properties / weight_property / title
      Removed value: -"Weight Property"
    • addedInput schema / properties / weight_property / type
      Added value: +"string"
    • removedInput schema / title
      Removed value: -"dijkstraArguments"
    • changedOutput schema / (root)
      Previous value: -{
      -  "properties": {
      -    "result": {
      -      "title": "Result",
      -      "type": "string"
      -    }
      -  },
      -  "required": [
      -    "result"
      -  ],
      -  "title": "dijkstraOutput",
      -  "type": "object"
      -}New value: +null
  2. First observedv0.2.0

TDQS

A4.4/5.0
Behavior4/5

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

Annotations already declare readOnlyHint=true and openWorldHint=false, so the safety profile is covered. The description adds that the result includes distance, hop_count and the path's nodes, and it explains the traversal default and its meaning, which goes beyond the annotations.

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, both front-loaded with the return contract first and the direction default second. There is no filler and no restatement of the name.

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?

There is no output schema, and the description names the return fields, which is what an agent needs. The only omission is the behavior for unreachable pairs (null, error, or infinity) and any weight validation, which a caller would want to know.

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 50%: direction and weight_property are documented in the schema, while source_id and target_id are bare integers. The description compensates by framing them as the path's endpoints and by explaining the default semantics of direction and the unit-weight fallback ('without it each edge weighs 1').

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 names a specific algorithm and resource: 'Shortest weighted path from source_id to target_id', and lists the return values. No sibling computes shortest paths, so an agent can route this without reading further.

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?

It gives a rationale for the default ('how are A and C connected') and an explicit condition for the alternative ('pass direction="outgoing"' for dependency/flow queries). It does not say when not to use it, e.g. for unweighted adjacency, which get_neighbors covers.

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