get_aws_identity
Retrieve AWS identity details including account, user, and role information for the current MCP server session to verify authentication status.
Instructions
현재 MCP 서버가 사용하는 AWS 자격증명의 계정/사용자/Role 정보를 반환합니다
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| region | No | AWS 리전 (기본값: ap-northeast-2) | ap-northeast-2 |
Implementation Reference
- src/index.ts:228-249 (handler)The handler function that implements the get_aws_identity tool logic: creates STSClient with env credentials, calls GetCallerIdentityCommand, and returns AWS account, 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:69-82 (registration)Registration of the get_aws_identity tool in the ListTools response, including name, description, and input 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 (registration)Dispatcher case in the CallToolRequestHandler switch statement that routes calls to the getAwsIdentity handler.case 'get_aws_identity': return await getAwsIdentity((args ?? {}) as { region?: string });
- src/index.ts:72-81 (schema)Input schema definition for the get_aws_identity tool, specifying optional region parameter.inputSchema: { type: 'object', properties: { region: { type: 'string', description: 'AWS 리전 (기본값: ap-northeast-2)', default: 'ap-northeast-2' } } }