get_aws_identity
Retrieve detailed AWS account, user, and role information for the current credentials used by the MCP server, specifying the AWS region as needed.
Instructions
현재 MCP 서버가 사용하는 AWS 자격증명의 계정/사용자/Role 정보를 반환합니다
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| region | No | AWS 리전 (기본값: ap-northeast-2) | ap-northeast-2 |
Input Schema (JSON Schema)
{
"properties": {
"region": {
"default": "ap-northeast-2",
"description": "AWS 리전 (기본값: ap-northeast-2)",
"type": "string"
}
},
"type": "object"
}
Implementation Reference
- src/index.ts:228-249 (handler)The handler function for 'get_aws_identity' tool. Creates an STS client using environment variables for credentials and calls GetCallerIdentityCommand to retrieve AWS account ID, UserId, and ARN.async function getAwsIdentity(args: { region?: string }) { const region = args?.region || 'ap-northeast-2'; const credentials: AwsCredentialIdentity = { accessKeyId: process.env.AWS_ACCESS_KEY_ID || '', secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY || '', sessionToken: process.env.AWS_SESSION_TOKEN }; const client = new STSClient({ region, credentials }); const command = new GetCallerIdentityCommand({}); const response = await client.send(command); return { content: [ { type: 'text', text: `AWS 계정 정보\n\n• Account: ${response.Account}\n• UserId: ${response.UserId}\n• Arn: ${response.Arn}` } ] }; }
- src/index.ts:72-81 (schema)Input schema definition for the 'get_aws_identity' tool, specifying an optional 'region' parameter.inputSchema: { type: 'object', properties: { region: { type: 'string', description: 'AWS 리전 (기본값: ap-northeast-2)', default: 'ap-northeast-2' } } }
- src/index.ts:69-82 (registration)Registration of the 'get_aws_identity' tool in the ListToolsRequestHandler, including name, description, and schema.{ name: 'get_aws_identity', description: '현재 MCP 서버가 사용하는 AWS 자격증명의 계정/사용자/Role 정보를 반환합니다', inputSchema: { type: 'object', properties: { region: { type: 'string', description: 'AWS 리전 (기본값: ap-northeast-2)', default: 'ap-northeast-2' } } } }
- src/index.ts:99-100 (handler)Dispatch case in the CallToolRequestHandler that routes calls to the getAwsIdentity handler function.case 'get_aws_identity': return await getAwsIdentity((args ?? {}) as { region?: string });