← Public packages
@playrunner/mcp
Connect Playrunner Cloud to Kody, then build and run Playwright test workflows from your agent.
src/status.ts
46 lines · 1.2 KB · TypeScriptimport { describe, findServer } from './index.ts'
type StatusResult = {
connected: boolean
state: string
toolCount: number
tools: string[]
authUrl: string | null
nextStep: string
}
/**
* Report whether Playrunner Cloud is connected and what it exposes.
* Call this after the user approves authorisation, or any time a Playrunner
* tool call fails, to tell a live connection apart from an expired one.
*
* @returns Connection state, the discovered tool names, and an `authUrl` when
* authorisation is outstanding.
*
* @example
* import status from 'kody:@playrunner/mcp/status'
*
* const { connected, tools } = await status()
*/
export default async function status(): Promise<StatusResult> {
const server = await findServer()
if (!server) {
return {
authUrl: null,
connected: false,
nextStep:
'Playrunner is not saved on this account. Call the package root export to add it.',
state: 'missing',
toolCount: 0,
tools: [],
}
}
return {
authUrl: server.authUrl ?? null,
connected: server.state === 'ready',
nextStep: describe(server),
state: server.state,
toolCount: server.toolCount ?? 0,
tools: server.tools ?? [],
}
}