select-profile
Choose an AWS profile and optional region for subsequent AWS interactions. Automatically handles SSO authentication if required, ensuring secure and streamlined access to AWS resources.
Instructions
Selects AWS profile to use for subsequent interactions. If needed, does SSO authentication
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| profile | Yes | Name of the AWS profile to select | |
| region | No | Region to use (if not provided, us-east-1 is used) |
Input Schema (JSON Schema)
{
"properties": {
"profile": {
"description": "Name of the AWS profile to select",
"type": "string"
},
"region": {
"description": "Region to use (if not provided, us-east-1 is used)",
"type": "string"
}
},
"required": [
"profile"
],
"type": "object"
}
Implementation Reference
- index.ts:170-180 (handler)The main execution logic for the 'select-profile' tool. It parses the input arguments using SelectProfileSchema, fetches credentials for the specified profile using getCredentials function, updates the global selectedProfile, selectedProfileCredentials, and selectedProfileRegion state variables, and returns a success text response.} else if (name === "select-profile") { const { profile, region } = SelectProfileSchema.parse(args); const credentials = await getCredentials( profiles[profile], profile, profiles ); selectedProfile = profile; selectedProfileCredentials = credentials; selectedProfileRegion = region || "us-east-1"; return createTextResponse("Authenticated!");
- index.ts:121-124 (schema)Zod schema defining the input validation for the 'select-profile' tool: requires 'profile' string, optional 'region' string.const SelectProfileSchema = z.object({ profile: z.string(), region: z.string().optional(), });
- index.ts:91-109 (registration)Tool registration in the ListTools response, defining name, description, and input schema for 'select-profile'.{ name: "select-profile", description: "Selects AWS profile to use for subsequent interactions. If needed, does SSO authentication", inputSchema: { type: "object", properties: { profile: { type: "string", description: "Name of the AWS profile to select", }, region: { type: "string", description: "Region to use (if not provided, us-east-1 is used)", }, }, required: ["profile"], }, },