Export Secret to Environment Variables
get_secret_environment_variableLoad a secret's username and password into shell environment variables for bash, PowerShell, or cmd so credentials are used without exposing their values.
Instructions
Load a secret's username and password into shell environment variables.
This is the preferred way to use a credential: the value never appears in the conversation. When the server runs locally (stdio), it reads the secret itself and writes a private, self-deleting file of shell assignments, returning only the file's path; nothing else needs to be installed. Over HTTP transports it returns a script instead, which calls the Secret Server REST API with the server's short-lived access token (bash needs curl and jq; powershell needs nothing extra).
Before retrieving a secret, check whether it requires approval:
Call
get_secret(id, summary=True)and inspectrequiresApprovalandrequiresComment.If approval is required, call
get_pending_access_requests()to check for an existing grant, or request access and wait for approval viahandle_access_request().Always provide the comment parameter explaining why this secret is being accessed. If the action is tied to a ticket, incident, or change request, that reference must be named in the comment.
Parameters
secret_id:
Identifier of the secret to retrieve.
environment:
Target shell environment. Supported values are "bash",
"powershell" and "cmd".
comment:
Required when the secret has requiresComment or
requiresApproval set. Must explain why this secret is
being accessed and, if the action is tied to a formal request
(e.g. a Jira ticket, incident, or change request), that
reference must be included.
Returns
dict
script_path plus a run hint (local mode). Running it exports
SECRET_USERNAME_<id> and SECRET_PASSWORD_<id>.
str
The script text (HTTP transports).
dict
Error information if the secret requires approval or a comment
that was not provided.
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": {
"secret_id": "<secret_id>",
"environment": "<environment>"
},
"name": "get_secret_environment_variable"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| comment | No | ||
| secret_id | Yes | ||
| environment | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |