Skip to main content
Glama
MCPg - Production-grade PostgreSQL MCP Server

MCPg - Production-grade PostgreSQL MCP Server

Generate graph projection

generate_graph_projection
Read-only

Generates openCypher CREATE/MERGE statements to project a PostgreSQL relational schema into an Apache AGE property graph for review without execution.

Instructions

Generate openCypher CREATE/MERGE statements that project a relational schema into an Apache AGE property graph — rows become vertices (one label per table), foreign keys become edges. EMITS the Cypher for review; NEVER executes it (like generate_test_data). With row_limit=0 (default) it returns a schema-level template plan (one CREATE per label, one MERGE per edge type, $prop placeholders) reading only the catalog. With row_limit>0 it also emits concrete per-row statements (values escaped, NULLs omitted, capped at 1000 rows/table). Tables without a primary key still get node CREATEs but their edges are skipped (they can't be reliably MATCHed). NOTE: AGE materialises the data (this is a LOAD, not a virtual view); run the node statements before the edge statements; the projection is 1-hop faithful to the FK graph. Returns an object with available (AGE installed, advisory), schema, graph_name, row_limit, node_labels (list of label, source_table, key_columns, property_columns), edge_types (list of edge_type, from_label, to_label, from_key, to_key, fk_name), cypher_statements (generated, never executed), warnings, and detail.

Example: generate_graph_projection(schema='public', graph_name='g', row_limit=0)

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": {
      "schema": "<schema>"
    },
    "name": "generate_graph_projection"
  }
}

Input Schema

NameRequiredDescriptionDefault
schemaYes
tablesNo
databaseNoOptional: a database id from list_databases, to target a configured secondary (read-only) database; omit for the primary. Database names that are not configured ids are rejected.
row_limitNo
graph_nameNog

Output Schema

NameRequiredDescriptionDefault
detailYes
schemaYes
warningsYes
availableYes
row_limitYes
edge_typesYes
graph_nameYes
node_labelsYes
cypher_statementsYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv0.8.4
    • changedInput schema / properties / database / description
      Previous value: -"Optional: target a configured secondary (read-only) database by name; omit for the primary. Call list_databases to see the configured ids."New value: +"Optional: a database id from list_databases, to target a configured secondary (read-only) database; omit for the primary. Database names that are not configured ids are rejected."
  2. First observedv0.6.8

TDQS

A4.6/5.0
Behavior5/5

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

Adds substantial behavior beyond readOnlyHint: the 1000 rows/table cap, NULL omission and value escaping, the fact that PK-less tables get node CREATEs but no edges, the required node-before-edge execution order, and the caveat that AGE materialises data so this is a load rather than a virtual view. The 'never executed' claim is consistent with readOnlyHint=true.

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?

Front-loaded with the core action and the never-executes constraint before mode-specific detail. It is dense but nearly every sentence conveys actionable constraint; the enumerated return-field list is redundant given an output schema exists and is the one section that does not earn its space.

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?

For a generator with five parameters and mutation-adjacent semantics, the definition covers mode selection, row caps, PK handling, ordering, and the materialisation caveat, which is everything an agent needs to call it correctly. Return-value explanation is redundant since an output schema exists, but this does not leave a gap.

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?

With only 20% schema description coverage, the description carries most of the burden and does so for row_limit (0 vs >0 semantics, default, cap) and graph_name (via the example), while database is covered by its schema description. The `tables` parameter is never mentioned in the description, so one of five parameters remains semantically opaque.

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?

States a specific verb and artifact: generates openCypher CREATE/MERGE statements projecting a relational schema into an Apache AGE graph, with rows as vertices and FKs as edges. It immediately distinguishes itself from execution-oriented siblings (run_cypher) by declaring it NEVER executes, and from inspection siblings (describe_graph, list_graphs) by naming the generated output.

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?

Gives a clear decision rule between the two modes: row_limit=0 (default) yields a schema-level template plan reading only the catalog, while row_limit>0 emits concrete per-row statements. It names generate_test_data as the analogous non-executing generator but does not explicitly route the agent to run_cypher for execution or contrast with generate_graph_diagram, so the sibling mapping is slightly incomplete.

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

Deploy Server

Other Tools