> ## Documentation Index
> Fetch the complete documentation index at: https://docs.kubiya.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Context Graph Tools

> Tools for querying and modifying the organizational knowledge graph, including schema discovery, Cypher queries, and node management.

Context Graph tools enable the Meta Agent to interact with your organizational knowledge graph. Query infrastructure relationships, discover dependencies, and even modify the graph through natural language.

<Note>
  For detailed use cases and examples of Context Graph queries, see **[Context Graph Use Cases](/core-concepts/context-graph-use-cases)**.
</Note>

## Schema & Discovery

Understand the structure of your knowledge graph.

| Tool                 | Description                                                   |
| -------------------- | ------------------------------------------------------------- |
| `fetch_graph_schema` | Retrieve the current graph schema (node types, relationships) |
| `scan_graph_nodes`   | Search for nodes matching specified criteria                  |
| `get_node_labels`    | List all available node labels in the graph                   |

**Example Usage:**

```
"What types of nodes are in the context graph?"
"Show me the schema for AWS resources"
"Find all nodes related to the payments service"
```

***

## Query Execution

Execute queries against the knowledge graph.

| Tool                    | Description                                        |
| ----------------------- | -------------------------------------------------- |
| `execute_cypher_query`  | Execute a Cypher query against the graph           |
| `execute_dynamic_query` | Generate and execute queries from natural language |

**Example Usage:**

```
"Show me all AWS IAM roles and their policy relationships"
"What services depend on the payments database?"
"Find all EC2 instances connected to the production VPC"
"Which Lambda functions have access to S3 buckets?"
```

### Dynamic Query Generation

The Meta Agent can automatically generate Cypher queries from natural language. For example:

**Prompt:** "Show me all repositories with critical vulnerabilities"

**Generated Query:**

```cypher theme={null}
MATCH (repo:GitHubRepository)-[:HAS_VULNERABILITY]->(vuln:CVE)
WHERE vuln.severity = 'CRITICAL'
RETURN repo.name AS repository,
       COUNT(vuln) AS critical_count,
       COLLECT(vuln.id) AS cve_ids
ORDER BY critical_count DESC
```

***

## Graph Modification

Create and modify nodes and relationships.

| Tool                  | Description                                            |
| --------------------- | ------------------------------------------------------ |
| `create_node`         | Create a new node with specified labels and properties |
| `update_node`         | Update properties on an existing node                  |
| `create_relationship` | Create a relationship between two nodes                |
| `delete_relationship` | Remove a relationship                                  |

<Warning>
  Graph modification tools require appropriate permissions. Most read operations are available to all users, while write operations may be restricted based on your role.
</Warning>

**Example Usage:**

```
"Create a relationship showing that payments-service depends on user-auth"
"Add a new Application node for the new microservice"
"Update the owner property on the billing database node"
"Remove the deprecated CONNECTS_TO relationship between these services"
```

***

## Common Query Patterns

### Find Dependencies

```
"What depends on [resource name]?"
"Show me the dependency chain for [service]"
```

### Security Analysis

```
"Which IAM roles have admin access?"
"Find resources with public exposure"
"Show me all cross-account access patterns"
```

### Infrastructure Discovery

```
"List all databases and their connected services"
"What resources are in the production environment?"
"Show me the network topology for [VPC]"
```

***

## Related

* **[Context Graph Overview](/core-concepts/overview)** - Understanding the knowledge graph
* **[Graph Visualization](/core-concepts/graph-explorer)** - Visual exploration
* **[Queries](/core-concepts/queries)** - Writing Cypher queries
* **[Context Graph Use Cases](/core-concepts/context-graph-use-cases)** - Real-world examples
