Skip to main content
Glama
memgraph

Memgraph MCP Server

Official
by memgraph

run_query

Execute queries on Memgraph database using the Model Context Protocol, enabling interaction with graph data through natural language input.

Instructions

Run a query against Memgraph

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYes

Implementation Reference

  • server.py:25-25 (registration)
    Registration of the 'run_query' tool using the @mcp.tool() decorator.
    @mcp.tool()
  • server.py:26-33 (handler)
    Handler function that executes the 'run_query' tool logic by calling execute_query and handling errors.
    def run_query(query: str) -> list:
        """Run a query against Memgraph"""
        logger.info(f"Running query: {query}")
        try:
            result = execute_query(query)
            return result
        except Exception as e:
            return [f"Error: {str(e)}"]
  • Helper function to execute Cypher queries on Memgraph using the Neo4j driver.
    def execute_query(query):
        """Helper function to execute a query on Memgraph"""
        with driver.session() as session:
            return session.run(query).data()
Behavior2/5

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

With no annotations, the description carries full burden but only states the action without behavioral details. It doesn't disclose if this is read-only or mutating, what permissions are needed, error handling, or performance implications (e.g., timeouts, rate limits). This leaves significant gaps for safe invocation.

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 a single, direct sentence with no wasted words—it's front-loaded and appropriately sized for a simple tool. Every word earns its place by stating the core action.

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

Completeness2/5

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

Given no annotations, no output schema, and low schema coverage, the description is incomplete. It doesn't cover behavioral traits, parameter details, or return values, making it inadequate for a tool that likely executes database operations with potential side effects.

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

Parameters2/5

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

Schema description coverage is 0%, and the description adds no parameter semantics beyond the schema's 'query' field. It doesn't explain what the query should contain (e.g., syntax, format), expected inputs, or constraints, failing to compensate for the low coverage.

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

Purpose3/5

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

The description 'Run a query against Memgraph' clearly states the action (run) and target (Memgraph), but it's vague about what type of query (Cypher? SQL?) and what resources are affected. Without sibling tools, differentiation isn't needed, but the purpose remains somewhat generic.

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

Usage Guidelines2/5

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

No guidance is provided on when to use this tool—there are no alternatives mentioned, no context for usage, and no prerequisites or exclusions. The description assumes the agent knows when to run queries without any framing.

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

Related 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/memgraph/mcp-memgraph'

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