summaryrefslogtreecommitdiff
path: root/src/mcp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mcp')
-rw-r--r--src/mcp/lattex.mjs24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/mcp/lattex.mjs b/src/mcp/lattex.mjs
index 861ff40..cfac04a 100644
--- a/src/mcp/lattex.mjs
+++ b/src/mcp/lattex.mjs
@@ -486,6 +486,15 @@ const TOOLS = [
}
}
}
+ },
+ // ── Online Users ──
+ {
+ name: 'get_online_users',
+ description: 'Get the list of users currently online in this Overleaf project.',
+ inputSchema: {
+ type: 'object',
+ properties: {}
+ }
}
]
@@ -861,6 +870,21 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
)
}
+ case 'get_online_users': {
+ const cwd = process.cwd()
+ const usersPath = join(cwd, '.lattex-online-users.json')
+ try {
+ const users = JSON.parse(readFileSync(usersPath, 'utf-8'))
+ if (!Array.isArray(users) || users.length === 0) {
+ return textResult('No other users currently online.')
+ }
+ const lines = users.map(u => `- ${u.name}${u.email ? ` (${u.email})` : ''}`)
+ return textResult(`${users.length} user(s) online:\n${lines.join('\n')}`)
+ } catch {
+ return textResult('No other users currently online.')
+ }
+ }
+
default:
return errorResult(`Unknown tool: ${name}`)
}