Skip to main content
Glama
GrafeoDB

grafeo-mcp

Official
by GrafeoDB

dijkstra

Compute the shortest weighted path between two nodes in a graph. Returns total distance and the path as a node sequence.

Instructions

Find the shortest weighted path between two nodes (Dijkstra's algorithm).

Returns the total distance and the sequence of nodes along the path.

Use this tool when: you need the shortest or cheapest path between two known nodes. Do NOT use this for: discovering important nodes (use pagerank) or finding similar content (use vector_search).

Args: source_id: Starting node ID. target_id: Destination node ID. weight_property: Edge property to use as weight (e.g. "distance", "cost"). If None every edge has weight 1.0.

Returns: JSON object with {distance, path: [{node_id, labels, properties}, ...]}. Returns an error message if the nodes are unreachable.

Error recovery: If the result is null/unreachable, check that both node IDs exist (use get_node) and that there is a connecting path in the graph.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
source_idYes
target_idYes
weight_propertyNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior5/5

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

With no annotations, the description fully discloses behavior: returns distance and path, error if unreachable, weight_property defaults to 1.0. Includes error recovery steps, leaving little ambiguity.

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?

Well-structured with front-loaded purpose, usage guidelines, and parameter details. Minor redundancy in repeating parameter info that could be inferred from schema, but justified due to lack of schema descriptions.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

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

Covers algorithm, parameters, return format, error handling, and sibling differentiation. Provides enough context for correct agent invocation even without annotations or output schema descriptions.

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

Parameters5/5

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

Despite 0% schema description coverage, the description explains all three parameters: source_id (starting node), target_id (destination), weight_property (edge property, optional, default 1.0). Also describes return structure.

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 finds the shortest weighted path between two nodes using Dijkstra's algorithm. It distinguishes from sibling tools like pagerank and vector_search, specifying the exact algorithm and resource.

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?

Explicitly states when to use (shortest/cheapest path between known nodes) and when not to (use pagerank for important nodes, vector_search for similar content), providing clear alternatives.

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/GrafeoDB/grafeo-mcp'

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