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

# Tools Reference

**Custom agents** access specialized tools across six categories: **Knowledge Graph**, **Code Access**, **External**, **Project Management**, **Integration**, and **Code Changes**. Assign tools per task at agent creation to control what the agent can access during execution.

## Tool Categories

| Category | Description |
| - | - |
| [Knowledge Graph](#knowledge-graph-tools) | Query and traverse the codebase by node, tag, name, or semantic meaning |
| [Code Access](#code-access-tools) | Retrieve file contents, directory structures, and analyzed code element breakdowns |
| [External](#external-tools) | Search the web and extract content from external URLs |
| [Project Management](#project-management-tools) | Track tasks, requirements, and manage session-based workflows |
| [Integration](#integration-tools) | Connect with external services like GitHub, Jira, Linear, and Confluence |
| [Code Changes](#code-changes-management-tools) | Manage code modifications through a session-based change tracking system. Available exclusively to the Code Agent |

## Knowledge Graph Tools

Query and traverse the [context graph](https://docs.potpie.ai/concepts/context-engine.md) by node name, ID, tag, or semantic meaning. These tools identify relevant nodes and map the relationships between them.

> [accordion] Semantic Search
>
> `ask_knowledge_graph_queries`
>
> Execute natural language queries against the [context graph](https://docs.potpie.ai/concepts/context-engine.md) using **vector similarity search** over docstring [embeddings](https://docs.potpie.ai/concepts/inference). The primary tool for semantic codebase search.
>
> **Parameters:**
>
> * `query` (string, required): Natural language or structured query
> * `project_id` (string, required): Project to query
>
> **Returns:** Matching nodes, relationships, and relevance scores

> [accordion] Fuzzy Lookup
>
> `get_code_from_probable_node_name`
>
> Search for nodes using a probable name match. Use when the exact node name is unknown. Accepts `file_path:function_name` or `file_path:class_name` format.
>
> **Parameters:**
>
> * `name` (string, required): Probable node name to search for
> * `project_id` (string, required): Project to search within
>
> **Returns:** Code content and metadata for matching nodes

> [accordion] Exact Lookup
>
> `get_code_from_node_name`
>
> Retrieve code using the exact node name.
>
> **Parameters:**
>
> * `name` (string, required): Exact node name
> * `project_id` (string, required): Project to search within
>
> **Returns:** Code content and node metadata

> [accordion] Node Fetch
>
> `get_code_from_node_id`
>
> Fetch the exact code content for a specific node ID.
>
> **Parameters:**
>
> * `node_id` (string, required): The exact node ID to retrieve
>
> **Returns:** Complete code content, file path, and node metadata

> [accordion] Bulk Fetch
>
> `get_code_from_multiple_node_ids`
>
> Retrieve code from multiple node IDs in a single request.
>
> **Parameters:**
>
> * `node_ids` (string\[], required): Array of node IDs to retrieve
>
> **Returns:** Array of code contents and metadata for each node

> [accordion] Tag Filter
>
> `get_nodes_from_tags`
>
> Retrieve all code nodes matching one or more specified tags or labels.
>
> **Parameters:**
>
> * `tags` (string\[], required): Tags to filter by
> * `project_id` (string, required): Project to search within
>
> **Returns:** All nodes matching the specified tags

> [accordion] Graph by ID
>
> `get_code_graph_from_node_id`
>
> Retrieve the dependency graph for a specific node by its ID. Works best with Python, JavaScript, and TypeScript repositories.
>
> **Parameters:**
>
> * `node_id` (string, required): Node ID to retrieve the graph for
>
> **Returns:** Dependency graph with related nodes and edge types

> [accordion] Graph by Name
>
> `get_code_graph_from_node_name`
>
> Retrieve the dependency graph for a node by its name. Works best with `.py`, `.js`, and `.ts` files.
>
> **Parameters:**
>
> * `name` (string, required): Node name to retrieve the graph for
> * `project_id` (string, required): Project to search within
>
> **Returns:** Dependency graph with related nodes and edge types

> [accordion] Node Neighbors
>
> `get_node_neighbours_from_node_id`
>
> Retrieve the immediate neighboring nodes in the [context graph](https://docs.potpie.ai/concepts/context-engine.md) for a given node ID.
>
> **Parameters:**
>
> * `node_id` (string, required): Node ID to retrieve neighbors for
>
> **Returns:** List of neighboring nodes with relationship types

> [accordion] Smart Graph
>
> `intelligent_code_graph`
>
> Generate a filtered, context-aware code graph. Useful for reducing graph size in larger codebases while preserving the most relevant relationships.
>
> **Parameters:**
>
> * `node_id` (string, required): Starting node for the graph
> * `project_id` (string, required): Project to query
>
> **Returns:** Filtered dependency graph optimized for context relevance

## Code Access Tools

Retrieve file contents, directory structures, and structured code element breakdowns.

> [accordion] File Structure
>
> `get_code_file_structure`
>
> Retrieve the complete directory structure and file organization of a project.
>
> **Parameters:**
>
> * `project_id` (string, required): Project to retrieve structure for
> * `path` (string, optional): Specific path to retrieve (returns full tree if omitted)
>
> **Returns:** Hierarchical file and directory structure

> [accordion] Fetch File
>
> `fetch_file`
>
> Read file contents with line numbers.
>
> **Parameters:**
>
> * `file_path` (string, required): Path to the file
> * `project_id` (string, required): Project containing the file
>
> **Returns:** File contents with line numbers

> [accordion] Code Analysis
>
> `analyze_code_structure`
>
> Extract classes, functions, imports, and structural elements from a file.
>
> **Parameters:**
>
> * `file_path` (string, required): File to analyze
> * `project_id` (string, required): Project containing the file
>
> **Returns:** Structured representation of all code elements in the file

## Code Changes Management Tools

Available exclusively to the **Code Agent**. A **Redis-backed session** tracks all modifications with a 24-hour expiration. Export changes before the session expires.

> [accordion] Add File
>
> `add_file_to_changes`
>
> Create a new file in the current session.
>
> **Parameters:**
>
> * `file_path` (string, required): Path for the new file
> * `content` (string, required): File content
>
> **Returns:** Confirmation with file path

> [accordion] Update File
>
> `update_file_in_changes`
>
> Replace the entire content of an existing file in the session.
>
> **Parameters:**
>
> * `file_path` (string, required): File to update
> * `new_content` (string, required): Replacement content
>
> **Returns:** Update confirmation

> [accordion] Delete File
>
> `delete_file_in_changes`
>
> Mark a file for deletion in the current session.
>
> **Parameters:**
>
> * `file_path` (string, required): File to delete
>
> **Returns:** Deletion confirmation

> [accordion] Update Lines
>
> `update_file_lines`
>
> Modify a specific line range within a file.
>
> **Parameters:**
>
> * `file_path` (string, required): File to modify
> * `start_line` (integer, required): First line of the range
> * `end_line` (integer, required): Last line of the range
> * `new_content` (string, required): Replacement content
>
> **Returns:** Update confirmation

> [accordion] Find Replace
>
> `replace_in_file`
>
> Find and replace text within a file, with regex support.
>
> **Parameters:**
>
> * `file_path` (string, required): File to search in
> * `pattern` (string, required): Search pattern (supports regex)
> * `replacement` (string, required): Replacement text
>
> **Returns:** Count of replacements made

> [accordion] Insert Lines
>
> `insert_lines`
>
> Insert lines at a specific position within a file.
>
> **Parameters:**
>
> * `file_path` (string, required): File to modify
> * `line_number` (integer, required): Position to insert at
> * `content` (string, required): Content to insert
>
> **Returns:** Insertion confirmation

> [accordion] Delete Lines
>
> `delete_lines`
>
> Remove a specific line range from a file.
>
> **Parameters:**
>
> * `file_path` (string, required): File to modify
> * `start_line` (integer, required): First line to delete
> * `end_line` (integer, required): Last line to delete
>
> **Returns:** Deletion confirmation

> [accordion] Get File
>
> `get_file_from_changes`
>
> Retrieve the current content of a file from the session, including all pending changes.
>
> **Parameters:**
>
> * `file_path` (string, required): File to retrieve
>
> **Returns:** Current file content with all pending changes applied

> [accordion] List Files
>
> `list_files_in_changes`
>
> List all files modified in the current session.
>
> **Returns:** List of file paths with their change types (added, modified, deleted)

> [accordion] Search Changes
>
> `search_content_in_changes`
>
> Search across all modified files in the session.
>
> **Parameters:**
>
> * `query` (string, required): Search query
> * `regex` (boolean, optional): Enable regex matching
>
> **Returns:** Matching results with file paths and line numbers

> [accordion] Revert File
>
> `clear_file_from_changes`
>
> Revert all pending changes for a specific file.
>
> **Parameters:**
>
> * `file_path` (string, required): File to revert
>
> **Returns:** Revert confirmation

> [accordion] Clear Session
>
> `clear_all_changes`
>
> Discard all changes tracked in the current session.
>
> **Returns:** Clear confirmation

> [accordion] Changes Summary
>
> `get_changes_summary`
>
> Get an overview of all modifications tracked in the current session.
>
> **Returns:** Summary including file count, line changes, and change types

> [accordion] PR Changes
>
> `get_changes_for_pr`
>
> Retrieve a summary of all code changes for a given conversation. Used in delegated PR flows to verify changes exist in the session before calling `create_pr_workflow`.
>
> **Parameters:**
>
> * `conversation_id` (string, required): Conversation ID where changes are stored
>
> **Returns:** List of changed files with change types and counts

> [accordion] Export Changes
>
> `export_changes`
>
> Generate a patch file or changeset for applying all session modifications.
>
> **Parameters:**
>
> * `format` (string, default: `dict`): Export format: `dict`, `list`, `json`, or `diff`
>
> **Returns:** Formatted changeset ready for application

> [accordion] Preview File
>
> `show_updated_file`
>
> View a file with all pending changes applied.
>
> **Parameters:**
>
> * `file_path` (string, required): File to view
>
> **Returns:** Complete file content with all changes applied

> [accordion] Show Diff
>
> `show_diff`
>
> Display a unified diff of pending changes in the session.
>
> **Parameters:**
>
> * `file_path` (string, optional): Specific file to diff. Shows all pending changes if omitted.
>
> **Returns:** Unified diff output

> [accordion] File Diff
>
> `get_file_diff`
>
> Get a line-by-line diff for a specific file.
>
> **Parameters:**
>
> * `file_path` (string, required): File to diff
>
> **Returns:** Line-by-line diff for the specified file

> [accordion] Session Info
>
> `get_session_metadata`
>
> Retrieve session information and statistics.
>
> **Returns:** Session ID, conversation ID, file count, and created/updated timestamps. All session data expires after 24 hours.

## External Tools

Search the web and extract content from external URLs to supplement codebase knowledge with external documentation and resources.

> [accordion] Web Search
>
> `web_search_tool`
>
> Search external documentation, resources, and references.
>
> **Parameters:**
>
> * `query` (string, required): Search query
> * `num_results` (integer, default: `5`): Number of results to return
>
> **Returns:** Search results with titles, URLs, and snippets

> [accordion] Page Extractor
>
> `webpage_extractor`
>
> Extract text content from a specific URL.
>
> **Parameters:**
>
> * `url` (string, required): URL to extract content from
>
> **Returns:** Extracted text content and page metadata

> [accordion] Shell Command
>
> `bash_command`
>
> Execute read-only shell commands. Available only when the repository manager is active in the deployment. Agents cannot run commands that modify files or perform destructive operations.
>
> **Parameters:**
>
> * `command` (string, required): Shell command to execute
>
> **Returns:** Command output
>
> **Permitted use cases:** `git status`, directory listings, system information queries, read-only diagnostics.

## Project Management Tools

Track tasks, requirements, and manage session-based workflows for complex multi-step agent operations.

> [accordion] Create Todo
>
> `add_todo`
>
> Create a todo item to track work in the current session.
>
> **Parameters:**
>
> * `title` (string, required): Title of the todo item
> * `description` (string, optional): Additional detail about the task
>
> **Returns:** Todo ID and creation confirmation

> [accordion] Update Status
>
> `update_todo_status`
>
> Update the completion status of an existing todo item.
>
> **Parameters:**
>
> * `todo_id` (string, required): ID of the todo to update
> * `status` (string, required): New status: `pending`, `in_progress`, or `done`
>
> **Returns:** Updated todo with new status

> [accordion] Get Todo
>
> `get_todo`
>
> Retrieve a specific todo item by ID.
>
> **Parameters:**
>
> * `todo_id` (string, required): ID of the todo to retrieve
>
> **Returns:** Todo details including title, description, status, and notes

> [accordion] List Todos
>
> `read_todos`
>
> List all todo items tracked in the current session.
>
> **Returns:** All todo items with their statuses and notes

> [accordion] Add Note
>
> `add_todo_note`
>
> Append a note to an existing todo item.
>
> **Parameters:**
>
> * `todo_id` (string, required): ID of the todo to update
> * `note` (string, required): Note content to append
>
> **Returns:** Updated todo with the new note

> [accordion] Todo Summary
>
> `get_todo_summary`
>
> Get an overview of all todo items and their statuses in the current session.
>
> **Returns:** Todo counts by status and a summary of pending and completed work

> [accordion] Add Requirements
>
> `add_requirements`
>
> Store requirements or constraints for the current agent session.
>
> **Parameters:**
>
> * `requirements` (string, required): Requirements content to store
>
> **Returns:** Confirmation of stored requirements

> [accordion] Get Requirements
>
> `get_requirements`
>
> Retrieve requirements from the current session.
>
> **Returns:** Stored requirements content

> [accordion] Delete Requirements
>
> `delete_requirements`
>
> Remove requirements from the current session. Available exclusively to the **Code Agent**.
>
> **Returns:** Deletion confirmation

## Integration Tools

Connect with external services like GitHub, Jira, Linear, and Confluence to extend agent capabilities beyond the codebase.

### GitHub Tools

> [accordion] Issue Fetcher
>
> `github_tool`
>
> Fetch GitHub issues and pull requests with full details including diffs.
>
> **Parameters:**
>
> * `repo` (string, required): Repository in `owner/repo` format
> * `issue_or_pr_number` (integer, required): Issue or PR number to fetch
>
> **Returns:** Title, description, status, assignee, labels, and diff (for PRs)

> [accordion] File Reader
>
> `code_provider_tool`
>
> Read file contents from a repository.
>
> **Parameters:**
>
> * `repo` (string, required): Repository in `owner/repo` format
> * `file_path` (string, required): Path to the file
>
> **Returns:** File contents

> [accordion] Branch Creator
>
> `code_provider_create_branch`
>
> Create a new branch from an existing branch or commit.
>
> **Parameters:**
>
> * `repo` (string, required): Repository in `owner/repo` format
> * `branch_name` (string, required): Name for the new branch
> * `source_branch` (string, required): Branch or commit to create from
>
> **Returns:** Branch creation confirmation

> [accordion] File Committer
>
> `code_provider_update_file`
>
> Modify file contents and commit the change.
>
> **Parameters:**
>
> * `repo` (string, required): Repository in `owner/repo` format
> * `file_path` (string, required): Path to the file
> * `content` (string, required): New file content
> * `commit_message` (string, required): Commit message
>
> **Returns:** Commit SHA and update confirmation

> [accordion] PR Creator
>
> `code_provider_create_pr`
>
> Create a pull request with a title, description, and reviewers.
>
> **Parameters:**
>
> * `repo` (string, required): Repository in `owner/repo` format
> * `title` (string, required): PR title
> * `head` (string, required): Source branch
> * `base` (string, required): Target branch
> * `body` (string, optional): PR description
>
> **Returns:** PR URL and number

> [accordion] PR Commenter
>
> `code_provider_add_pr_comment`
>
> Add a comment to a pull request or a specific line within it.
>
> **Parameters:**
>
> * `repo` (string, required): Repository in `owner/repo` format
> * `pr_number` (integer, required): PR number
> * `body` (string, required): Comment content
> * `file_path` (string, optional): File path for inline comment
> * `line` (integer, optional): Line number for inline comment
>
> **Returns:** Comment URL and ID

### Linear Tools

> [accordion] Issue Fetcher
>
> `get_linear_issue`
>
> Fetch detailed information about a Linear issue.
>
> **Parameters:**
>
> * `issue_id` (string, required): Issue ID or key (e.g. `ABC-123`)
>
> **Returns:** Title, description, status, assignee, team, priority, URL, and timestamps

> [accordion] Issue Updater
>
> `update_linear_issue`
>
> Update properties of a Linear issue.
>
> **Parameters:**
>
> * `issue_id` (string, required): Issue ID or key
> * `input` (object, required): Fields to update — title, description, status, priority, assignee, team, or labels
>
> **Returns:** Updated issue confirmation

### Jira Tools

> [accordion] Issue Creator
>
> `create_jira_issue_tool`
>
> Create a new Jira issue in a project.
>
> **Parameters:**
>
> * `project_key` (string, required): Project key (e.g. `ENG`)
> * `summary` (string, required): Issue title
> * `description` (string, optional): Issue description
> * `issue_type` (string, optional): Issue type (Bug, Task, Story)
> * `priority` (string, optional): Priority level
>
> **Returns:** Issue key and URL

> [accordion] Issue Fetcher
>
> `get_jira_issue_tool`
>
> Fetch details for a Jira issue.
>
> **Parameters:**
>
> * `issue_key` (string, required): Issue key (e.g. `ENG-123`)
>
> **Returns:** Title, description, status, assignee, priority, comments, and attachments

> [accordion] Issue Updater
>
> `update_jira_issue_tool`
>
> Update fields on a Jira issue.
>
> **Parameters:**
>
> * `issue_key` (string, required): Issue key
> * `fields` (object, required): Fields to update — description, assignee, priority, etc.
>
> **Returns:** Update confirmation

> [accordion] Issue Search
>
> `search_jira_issues_tool`
>
> Search Jira issues using JQL.
>
> **Parameters:**
>
> * `jql` (string, required): JQL query string
> * `max_results` (integer, optional): Maximum results to return
>
> **Returns:** Matching issues with key, title, status, and assignee

> [accordion] Comment Writer
>
> `add_jira_comment_tool`
>
> Add a comment to a Jira issue.
>
> **Parameters:**
>
> * `issue_key` (string, required): Issue key
> * `body` (string, required): Comment content
>
> **Returns:** Comment ID and URL

> [accordion] Status Mover
>
> `transition_jira_issue_tool`
>
> Move a Jira issue to a new status.
>
> **Parameters:**
>
> * `issue_key` (string, required): Issue key
> * `transition` (string, required): Target status name (e.g. `In Progress`, `Done`)
>
> **Returns:** Transition confirmation

> [accordion] Issue Linker
>
> `link_jira_issues_tool`
>
> Create a link between two Jira issues.
>
> **Parameters:**
>
> * `inward_issue` (string, required): Source issue key
> * `outward_issue` (string, required): Target issue key
> * `link_type` (string, required): Link type — blocks, relates to, duplicates, clones
>
> **Returns:** Link creation confirmation

> [accordion] Project Lister
>
> `get_jira_projects_tool`
>
> List all accessible Jira projects.
>
> **Returns:** Project keys, names, and types

> [accordion] Project Details
>
> `get_jira_project_details_tool`
>
> Get metadata for a specific Jira project.
>
> **Parameters:**
>
> * `project_key` (string, required): Project key
>
> **Returns:** Project name, description, lead, issue types, and statuses

> [accordion] Project Members
>
> `get_jira_project_users_tool`
>
> List members of a Jira project.
>
> **Parameters:**
>
> * `project_key` (string, required): Project key
>
> **Returns:** User list with names and account IDs

### Confluence Tools

> [accordion] Space Lister
>
> `get_confluence_spaces_tool`
>
> List all accessible Confluence spaces.
>
> **Returns:** Space keys, names, and types (global/personal)

> [accordion] Page Fetcher
>
> `get_confluence_page_tool`
>
> Retrieve a Confluence page by ID.
>
> **Parameters:**
>
> * `page_id` (string, required): Confluence page ID
>
> **Returns:** Title, body content, version, space, and creator

> [accordion] Space Pages
>
> `get_confluence_space_pages_tool`
>
> List all pages in a Confluence space.
>
> **Parameters:**
>
> * `space_key` (string, required): Space key (e.g. `DOCS`)
>
> **Returns:** Page list with titles, IDs, and creation dates

> [accordion] Page Search
>
> `search_confluence_pages_tool`
>
> Search Confluence content using CQL.
>
> **Parameters:**
>
> * `cql` (string, required): CQL query string
> * `limit` (integer, optional): Maximum results to return
>
> **Returns:** Matching pages with title, space, and excerpt

> [accordion] Page Creator
>
> `create_confluence_page_tool`
>
> Create a new Confluence page.
>
> **Parameters:**
>
> * `space_key` (string, required): Space to create the page in
> * `title` (string, required): Page title
> * `content` (string, required): Page content (Markdown auto-converted to storage format)
> * `parent_id` (string, optional): Parent page ID
>
> **Returns:** Page ID and URL

> [accordion] Page Updater
>
> `update_confluence_page_tool`
>
> Update an existing Confluence page. Automatically increments version number.
>
> **Parameters:**
>
> * `page_id` (string, required): Page ID to update
> * `title` (string, optional): New title
> * `content` (string, optional): New content
>
> **Returns:** Update confirmation with new version number

> [accordion] Comment Writer
>
> `add_confluence_comment_tool`
>
> Add a comment to a Confluence page.
>
> **Parameters:**
>
> * `page_id` (string, required): Page ID
> * `body` (string, required): Comment content
>
> **Returns:** Comment ID and confirmation

### Change Detection

> [accordion] Change Detection
>
> `change_detection`
>
> Detect code changes in the current branch compared to the default branch and retrieve updated function details.
>
> **Parameters:**
>
> * `base_branch` (string, default: `main`): Branch to compare against
> * `target_branch` (string, optional): Branch or commit to compare (defaults to current)
> * `project_id` (string, required): Project to analyze
>
> **Returns:** Changed files with diff information and impact analysis


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.