Skip to main content
Glama
softagram

SGraph MCP Server

Official
by softagram

sgraph_cypher_query

Run read-only openCypher queries against the loaded model to analyze complex dependencies, multi-hop paths, and aggregated results with flexible filtering.

Instructions

Run an openCypher query against the loaded model. Powerful and flexible.

Use this tool for complex graph queries that the other tools can't express:

  • Multi-hop path queries, transitive dependencies

  • Aggregation (count, group by)

  • Complex filtering with AND/OR/NOT

  • Joining different relationship types

The sgraph model is mapped to a labeled property graph:

Nodes (= code elements):

  • Labels come from element type: :file, :class, :function, :dir, :method, etc.

  • Properties: name, path (always present), plus all element attributes

  • Elements without a type have no label

Relationships (= dependencies):

  • Type comes from deptype: :imports, :function_ref, :call, :inc, :uses, etc.

  • Properties: any edge-level attributes

  • :CONTAINS relationships represent parent-child hierarchy (off by default)

Example queries:

"What files does main.py import?" MATCH (a:file)-[:imports]->(b:file) WHERE a.name = 'main.py' RETURN b.name, b.path

"Count dependencies per file, top 10:" MATCH (a:file)-[r]->(b) WHERE type(r) <> 'CONTAINS' RETURN a.name, count(r) AS deps ORDER BY deps DESC LIMIT 10

"Find all transitive imports from a file (up to 3 hops):" MATCH (a:file)-[:imports*1..3]->(b) WHERE a.name = 'app.py' RETURN DISTINCT b.name, b.path

"Files with more than 500 lines of code:" MATCH (f:file) WHERE f.loc > 500 RETURN f.name, f.loc ORDER BY f.loc DESC

"Does module A depend on module B? (directory-level)" MATCH (a)-[r]->(b) WHERE a.path STARTS WITH '/project/src/web/' AND b.path STARTS WITH '/project/src/db/' AND type(r) <> 'CONTAINS' RETURN type(r), count(r) AS cnt ORDER BY cnt DESC

Performance notes:

  • include_hierarchy=false (default) is faster, omits :CONTAINS edges

  • Enable include_hierarchy only for parent-child traversal queries

  • Large models take a few seconds for initial indexing (cached per model)

  • Variable-length paths (*1..N) with large N can be slow

Returns JSON array of result rows. Read-only: CREATE/DELETE/SET not supported.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
inputYes

Schema Changelog

Changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. First observedv0.1.0

TDQS

A4.9/5.0
Behavior5/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure, and it does so thoroughly. It documents the read-only constraint, what the graph mapping looks like, how relationships are represented, the performance trade-offs of include_hierarchy, that results are returned as a JSON array, and that initial indexing may take seconds on large models. This is unusually transparent for a tool description.

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?

The description is long but well-structured and front-loaded. The first sentence states the core behavior, followed by usage guidance, graph schema information, examples, performance notes, and return format. Every section adds value needed to use the tool correctly; the examples are illustrative rather than redundant. This is appropriate density for a complex query tool, not padding.

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?

The tool is complex, has no output schema, and has no annotations, yet the description covers all essential invocation concerns: what the model is, how to write queries, relationship types, property names, hierarchy behavior, performance expectations, return format, and read-only constraints. An agent has enough information to construct and run a correct openCypher query without external documentation.

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?

The top-level schema reports 0% description coverage, so the description must compensate. It does so substantially by explaining the query language, node/relationship mapping, property conventions, and hierarchy behavior. It does not explicitly explain the `limit` safety parameter or `model_id` optionality, but the schema itself describes those fields, and the examples demonstrate how to write valid queries. This is strong compensation but not exhaustive.

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 opens with a specific verb and resource: 'Run an openCypher query against the loaded model.' It goes beyond a tautology by explaining what the tool expresses — multi-hop paths, aggregation, complex filtering — and explicitly differentiates itself from other tools by noting these are queries 'the other tools can't express.' The mapping to a labeled property graph and example queries make the purpose unmistakable.

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?

The description explicitly states when to use this tool: 'Use this tool for complex graph queries that the other tools can't express,' followed by concrete categories. It also gives exclusions, telling users that CREATE/DELETE/SET are not supported and that include_hierarchy=false is the recommended default unless parent-child traversal is needed. This gives the agent clear selection criteria relative to sibling tools.

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

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/softagram/sgraph-mcp-server'

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