iam_get_token_info
Retrieves details of the current IAM token and associated IBM Cloud account.
Instructions
Get information about the current IAM token and account
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "iam_get_token_info"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/iam/index.ts:7-7 (registration)The registerIAMTools function registers all IAM tools on the MCP server, including 'iam_get_token_info'.
export function registerIAMTools(server: McpServer, client: IBMCloudAPIClient, config: ServerConfig) { - src/tools/iam/index.ts:11-18 (handler)The tool handler: calls the IAM introspection endpoint to get information about the current IAM token and account. No input parameters (empty schema). Uses the safeTool wrapper for error handling.
server.tool( "iam_get_token_info", "Get information about the current IAM token and account", {}, async () => safeTool(async () => { return client.get(`${IBM_ENDPOINTS.IAM}/identity/introspect`, {}); }) ); - src/tools/iam/index.ts:14-14 (schema)The input schema is an empty object (no parameters required).
{}, - src/lib/utils.ts:70-77 (helper)The safeTool helper wraps the handler to catch errors and return proper MCP formatted responses.
export async function safeTool<T>(fn: () => Promise<T>): Promise<ReturnType<typeof successContent> | ReturnType<typeof errorContent>> { try { const result = await fn(); return successContent(result); } catch (error) { return errorContent(error); } }