Sourcegraph connects to a Nagent workspace with an API key. Once it is connected, agents can call 8 Sourcegraph actions, such as "Get Commit Details", "Get Current User" and "Get File Contents". Nothing is enabled on connect: each action is allowed one at a time, and an action with side effects runs or waits for a person according to the agent's level.
Every operation an agent can call against Sourcegraph, with input parameters and output schema.
SOURCEGRAPH_CHECK_SITE_SETTINGS_EDIT_PERMISSIONTool to check whether site settings can be edited through the API. Use when you need to confirm the API allows site settings edits before attempting configuration changes.
Output
Data from the action execution
Error if any occurred during the execution of the action
Whether or not the action execution was successful or not
SOURCEGRAPH_COMPARE_COMMITSTool to compare two commits in a repository and retrieve their file diffs. Use after confirming the repository name and commit SHAs to inspect differences.
Input parameters
Base commit SHA or ref to compare from
Head commit SHA or ref to compare to
Repository name in format 'github.com/owner/repo'
Output
Data from the action execution
Error if any occurred during the execution of the action
Whether or not the action execution was successful or not
SOURCEGRAPH_GET_COMMIT_DETAILSGet detailed information about a specific commit in a repository.
Input parameters
Commit SHA, branch name, or tag to get details for
Repository name in format 'github.com/owner/repo'
Output
Data from the action execution
Error if any occurred during the execution of the action
Whether or not the action execution was successful or not
SOURCEGRAPH_GET_CURRENT_USERTool to retrieve information about the currently authenticated user. Use when needing confirmation of identity via Sourcegraph GraphQL API.
Output
Data from the action execution
Error if any occurred during the execution of the action
Whether or not the action execution was successful or not
SOURCEGRAPH_GET_FILE_CONTENTSTool to fetch the contents of a specified file on the default branch. Use when you need raw file text without cloning the repo or using a slower code-host API.
Input parameters
Path to the file in the repository, relative to the root, e.g., 'README.md'.
Full repository name, including host and path, e.g., 'github.com/uber/react-map-gl'.
Output
Data from the action execution
Error if any occurred during the execution of the action
Whether or not the action execution was successful or not
SOURCEGRAPH_LIST_REPOSITORIESTool to list repositories on the Sourcegraph instance. Use when you need to paginate through all available repositories.
Input parameters
Pagination cursor returned from previous page; omit for first page.
Number of repositories to retrieve (1-1000).
Output
Data from the action execution
Error if any occurred during the execution of the action
Whether or not the action execution was successful or not
SOURCEGRAPH_LIST_REPOSITORY_FILESTool to list all files and directories in a repository path. Use when you need to enumerate files in a repository without cloning.
Input parameters
Git ref (branch, tag, or commit SHA). Defaults to HEAD.
Path within the repository. Defaults to root ('').
Whether to list files recursively. Defaults to True.
Full repository name, e.g., 'github.com/owner/repo'
Output
Data from the action execution
Error if any occurred during the execution of the action
Whether or not the action execution was successful or not
SOURCEGRAPH_LIST_REPOSITORY_LANGUAGESTool to list languages used in a repository. Use when you need to determine the primary and all languages of a given repository; call after you have the repository name.
Input parameters
Full name of the repository (e.g., 'github.com/gorilla/mux').
Output
Data from the action execution
Error if any occurred during the execution of the action
Whether or not the action execution was successful or not
Agents can call 8 Sourcegraph actions on Nagent, including "Get Commit Details", "Get Current User" and "Get File Contents". Get Commit Details: Get detailed information about a specific commit in a repository. Each action is listed on this page with its input parameters and its output.
Sourcegraph connects with an API key, under your workspace's own connection. Nothing is enabled on connect: each action is allowed one at a time and can be scoped to the agents that need it.
Get Commit Details takes 2 required inputs: rev and repo. It returns data, error and successful.