swit-oauth-status
Verify OAuth authentication status for the Swit MCP Server integration to confirm if it is properly authenticated and ready.
Instructions
Check OAuth authentication status
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": "swit-oauth-status"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/handlers/oauth.handlers.ts:3-15 (handler)The handler function (handleOAuthStatus) that executes the 'swit-oauth-status' tool logic. It checks OAuth authentication status and returns whether the user is authenticated, the status message, the web server URL, and a contextual message.
export const handleOAuthStatus = async (oauthWebServer: OAuthWebServer | null) => { const isAuthenticated = oauthWebServer?.isAuthenticated() || false; const port = process.env.OAUTH_PORT || '3000'; return { authenticated: isAuthenticated, status: isAuthenticated ? 'Authenticated' : 'Authentication required', webServerUrl: oauthWebServer ? `http://localhost:${port}` : null, message: isAuthenticated ? 'OAuth authentication completed. Swit API is ready to use.' : 'OAuth authentication required. Use swit-oauth-start tool to begin authentication.', }; }; - src/tools/oauth.tools.ts:7-10 (schema)The tool schema definition for 'swit-oauth-status'. It registers the tool name, description ('Check OAuth authentication status'), and an empty input schema (no parameters required).
{ name: 'swit-oauth-status', description: 'Check OAuth authentication status', inputSchema: zodToJsonSchema(EmptySchema), - src/index.ts:109-109 (registration)Where the tool handler is registered into the toolHandlers map: oauthHandlers(oauthWebServer) is spread into toolHandlers, which includes the 'swit-oauth-status' handler.
toolHandlers = { ...oauthHandlers(oauthWebServer), ...coreHandlers(switClient) }; - src/index.ts:61-62 (registration)The ListToolsRequestSchema handler that returns the list of all tools, including oauthTools (which contains 'swit-oauth-status') registered with the MCP server.
server.setRequestHandler(ListToolsRequestSchema, async () => { return { tools: [...oauthTools, ...coreTools] }; - src/handlers/oauth.handlers.ts:62-66 (registration)The oauthHandlers factory function that maps 'swit-oauth-status' to the handleOAuthStatus function, connecting the tool name to its implementation.
export const oauthHandlers = (oauthWebServer: OAuthWebServer | null) => ({ 'swit-oauth-status': () => handleOAuthStatus(oauthWebServer), 'swit-oauth-start': () => handleOAuthStart(oauthWebServer), 'swit-oauth-logout': () => handleOAuthLogout(oauthWebServer), });