Package io.meeds.poll.mcp
Class PollMcpTool
java.lang.Object
io.meeds.poll.mcp.PollMcpTool
- All Implemented Interfaces:
io.meeds.mcp.server.plugin.McpToolPlugin
@Service
@Profile("mcp-server")
public class PollMcpTool
extends Object
implements io.meeds.mcp.server.plugin.McpToolPlugin
MCP tools exposing the Poll add-on to the AI agent (EVA). Every method acts
as the current user, so space membership and redactor permissions are
enforced by
PollService.-
Field Summary
Fields inherited from interface io.meeds.mcp.server.plugin.McpToolPlugin
DEFAULT_LIMIT, DEFAULT_OFFSET -
Constructor Summary
ConstructorsConstructorDescriptionPollMcpTool(io.meeds.poll.service.PollService pollService, org.exoplatform.social.core.space.spi.SpaceService spaceService, org.exoplatform.social.core.manager.IdentityManager identityManager, org.exoplatform.social.core.manager.ActivityManager activityManager) -
Method Summary
Modifier and TypeMethodDescriptionCreates a poll (with its options) and posts it to a space activity stream.getPollResults(Long pollId) Returns a poll's question, options and current vote tallies.listSpacePolls(Long spaceId, Integer limit) Lists the polls posted in a space (most recent first) with their ids and current results, so a poll can be found without knowing its id.voteInPoll(Long pollOptionId) Casts the current user's vote for a poll option and returns the updated results.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.meeds.mcp.server.plugin.McpToolPlugin
getCurrentUserAclIdentity, getCurrentUserLocale, getCurrentUserLocale, getCurrentUserName, getLocale
-
Constructor Details
-
PollMcpTool
public PollMcpTool(io.meeds.poll.service.PollService pollService, org.exoplatform.social.core.space.spi.SpaceService spaceService, org.exoplatform.social.core.manager.IdentityManager identityManager, org.exoplatform.social.core.manager.ActivityManager activityManager)
-
-
Method Details
-
createPoll
public PollResultModel createPoll(Long spaceId, String question, List<String> options, String duration, String message) throws IllegalAccessException Creates a poll (with its options) and posts it to a space activity stream.- Throws:
IllegalAccessException
-
voteInPoll
public PollResultModel voteInPoll(Long pollOptionId) throws IllegalAccessException, org.exoplatform.commons.exception.ObjectNotFoundException Casts the current user's vote for a poll option and returns the updated results.- Throws:
IllegalAccessExceptionorg.exoplatform.commons.exception.ObjectNotFoundException
-
getPollResults
public PollResultModel getPollResults(Long pollId) throws IllegalAccessException, org.exoplatform.commons.exception.ObjectNotFoundException Returns a poll's question, options and current vote tallies.- Throws:
IllegalAccessExceptionorg.exoplatform.commons.exception.ObjectNotFoundException
-
listSpacePolls
Lists the polls posted in a space (most recent first) with their ids and current results, so a poll can be found without knowing its id.
-