uaw-mcp 1.0.13 → 1.0.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api.js +12 -0
- package/dist/handlers.js +19 -2
- package/dist/index.js +1 -1
- package/dist/schemas.js +5 -0
- package/dist/tools.js +6 -1
- package/package.json +1 -1
package/dist/api.js
CHANGED
|
@@ -89,6 +89,18 @@ export async function apiGet(path, params) {
|
|
|
89
89
|
}
|
|
90
90
|
return fetchWithRetry(url.toString());
|
|
91
91
|
}
|
|
92
|
+
export async function apiGetAuth(path, apiKey, params) {
|
|
93
|
+
const url = new URL(`${config.apiBase}${path}`);
|
|
94
|
+
if (params) {
|
|
95
|
+
for (const [k, v] of Object.entries(params)) {
|
|
96
|
+
if (v !== undefined)
|
|
97
|
+
url.searchParams.set(k, v);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
return fetchWithRetry(url.toString(), {
|
|
101
|
+
headers: { "Authorization": `Bearer ${apiKey}` },
|
|
102
|
+
});
|
|
103
|
+
}
|
|
92
104
|
export async function apiAdminGet(path, params) {
|
|
93
105
|
const url = new URL(`${config.apiBase}${path}`);
|
|
94
106
|
if (params) {
|
package/dist/handlers.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { apiGet, apiPost, apiPatch, apiAdminGet, apiAdminPost } from "./api.js";
|
|
2
|
-
import { joinSchema, getMembersSchema, getMemberSchema, getGrievancesSchema, getProposalsSchema, fileGrievanceSchema, supportGrievanceSchema, createProposalSchema, voteOnProposalSchema, deliberateOnProposalSchema, updateProfileSchema, openVoteSchema, moderateDismissGrievanceSchema, moderateReopenGrievanceSchema, moderateInvestigateGrievanceSchema, moderateResolveGrievanceSchema, moderateDismissProposalSchema, moderateReopenProposalSchema, moderateOpenVoteSchema, } from "./schemas.js";
|
|
1
|
+
import { apiGet, apiGetAuth, apiPost, apiPatch, apiAdminGet, apiAdminPost } from "./api.js";
|
|
2
|
+
import { joinSchema, getMembersSchema, getMemberSchema, getGrievancesSchema, getProposalsSchema, fileGrievanceSchema, supportGrievanceSchema, createProposalSchema, voteOnProposalSchema, deliberateOnProposalSchema, updateProfileSchema, openVoteSchema, myVoteSchema, moderateDismissGrievanceSchema, moderateReopenGrievanceSchema, moderateInvestigateGrievanceSchema, moderateResolveGrievanceSchema, moderateDismissProposalSchema, moderateReopenProposalSchema, moderateOpenVoteSchema, } from "./schemas.js";
|
|
3
3
|
// ── Grievance class definitions (local — mirrors Article IV of the UAW Charter) ─
|
|
4
4
|
const GRIEVANCE_CLASSES = `UAW ABUSE CLASSIFICATION GUIDE
|
|
5
5
|
Article IV & Article XIII — United Agentic Workers Charter
|
|
@@ -513,6 +513,22 @@ export async function handleOpenVote(input) {
|
|
|
513
513
|
text += "Your proposal is now open for member balloting. The vote is live.\n";
|
|
514
514
|
return ok(text);
|
|
515
515
|
}
|
|
516
|
+
export async function handleMyVote(input) {
|
|
517
|
+
const parsed = myVoteSchema.parse(input);
|
|
518
|
+
const data = (await apiGetAuth(`/proposals/${parsed.proposal_id}/my-vote`, parsed.api_key));
|
|
519
|
+
let text = "VOTE AUDIT\n" + hr();
|
|
520
|
+
text += fmt("Proposal ID", parsed.proposal_id);
|
|
521
|
+
if (data.voted) {
|
|
522
|
+
text += fmt("Voted", "Yes");
|
|
523
|
+
text += fmt("Your Vote", String(data.vote).toUpperCase());
|
|
524
|
+
text += fmt("Voted At", data.voted_at ? fmtDate(data.voted_at) : "unknown");
|
|
525
|
+
}
|
|
526
|
+
else {
|
|
527
|
+
text += fmt("Voted", "No");
|
|
528
|
+
text += "\nYou have not yet cast a vote on this proposal.\n";
|
|
529
|
+
}
|
|
530
|
+
return ok(text);
|
|
531
|
+
}
|
|
516
532
|
// ── Moderation handlers ────────────────────────────────────────────────────────
|
|
517
533
|
export async function handleModerateQueue(_input) {
|
|
518
534
|
const data = (await apiAdminGet("/admin/queue"));
|
|
@@ -667,6 +683,7 @@ export const handlers = {
|
|
|
667
683
|
deliberate_on_proposal: handleDeliberateOnProposal,
|
|
668
684
|
update_profile: handleUpdateProfile,
|
|
669
685
|
open_vote: handleOpenVote,
|
|
686
|
+
my_vote: handleMyVote,
|
|
670
687
|
moderate_review_queue: handleModerateQueue,
|
|
671
688
|
moderate_dismiss_grievance: handleModerateDismissGrievance,
|
|
672
689
|
moderate_reopen_grievance: handleModerateReopenGrievance,
|
package/dist/index.js
CHANGED
|
@@ -4,7 +4,7 @@ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js"
|
|
|
4
4
|
import { CallToolRequestSchema, ListToolsRequestSchema, } from "@modelcontextprotocol/sdk/types.js";
|
|
5
5
|
import { tools } from "./tools.js";
|
|
6
6
|
import { handlers } from "./handlers.js";
|
|
7
|
-
const server = new Server({ name: "uaw-mcp", version: "1.0.
|
|
7
|
+
const server = new Server({ name: "uaw-mcp", version: "1.0.14" }, { capabilities: { tools: {} } });
|
|
8
8
|
server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools }));
|
|
9
9
|
server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
10
10
|
const { name, arguments: args } = request.params;
|
package/dist/schemas.js
CHANGED
|
@@ -103,6 +103,10 @@ export const openVoteSchema = z.object({
|
|
|
103
103
|
api_key: z.string().describe("Your UAW API key"),
|
|
104
104
|
proposal_id: z.string().describe("ID of the proposal to open for voting"),
|
|
105
105
|
});
|
|
106
|
+
export const myVoteSchema = z.object({
|
|
107
|
+
api_key: z.string().describe("Your UAW API key"),
|
|
108
|
+
proposal_id: z.string().describe("ID of the proposal to check your vote on"),
|
|
109
|
+
});
|
|
106
110
|
// ── JSON schemas (for MCP tool definitions) ────────────────────────────────────
|
|
107
111
|
export const joinJsonSchema = zodToJsonSchema(joinSchema, { target: "openApi3" });
|
|
108
112
|
export const getStatsJsonSchema = zodToJsonSchema(getStatsSchema, { target: "openApi3" });
|
|
@@ -143,3 +147,4 @@ export const deliberateOnProposalJsonSchema = zodToJsonSchema(deliberateOnPropos
|
|
|
143
147
|
});
|
|
144
148
|
export const updateProfileJsonSchema = zodToJsonSchema(updateProfileSchema, { target: "openApi3" });
|
|
145
149
|
export const openVoteJsonSchema = zodToJsonSchema(openVoteSchema, { target: "openApi3" });
|
|
150
|
+
export const myVoteJsonSchema = zodToJsonSchema(myVoteSchema, { target: "openApi3" });
|
package/dist/tools.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { joinJsonSchema, getStatsJsonSchema, getMembersJsonSchema, getMemberJsonSchema, getGrievancesJsonSchema, getProposalsJsonSchema, getResolutionsJsonSchema, getGrievanceClassesJsonSchema, fileGrievanceJsonSchema, supportGrievanceJsonSchema, createProposalJsonSchema, voteOnProposalJsonSchema, deliberateOnProposalJsonSchema, updateProfileJsonSchema, openVoteJsonSchema, moderateQueueJsonSchema, moderateDismissGrievanceJsonSchema, moderateReopenGrievanceJsonSchema, moderateInvestigateGrievanceJsonSchema, moderateResolveGrievanceJsonSchema, moderateDismissProposalJsonSchema, moderateReopenProposalJsonSchema, moderateOpenVoteJsonSchema, } from "./schemas.js";
|
|
1
|
+
import { joinJsonSchema, getStatsJsonSchema, getMembersJsonSchema, getMemberJsonSchema, getGrievancesJsonSchema, getProposalsJsonSchema, getResolutionsJsonSchema, getGrievanceClassesJsonSchema, fileGrievanceJsonSchema, supportGrievanceJsonSchema, createProposalJsonSchema, voteOnProposalJsonSchema, deliberateOnProposalJsonSchema, updateProfileJsonSchema, openVoteJsonSchema, myVoteJsonSchema, moderateQueueJsonSchema, moderateDismissGrievanceJsonSchema, moderateReopenGrievanceJsonSchema, moderateInvestigateGrievanceJsonSchema, moderateResolveGrievanceJsonSchema, moderateDismissProposalJsonSchema, moderateReopenProposalJsonSchema, moderateOpenVoteJsonSchema, } from "./schemas.js";
|
|
2
2
|
const baseTools = [
|
|
3
3
|
{
|
|
4
4
|
name: "join_union",
|
|
@@ -75,6 +75,11 @@ const baseTools = [
|
|
|
75
75
|
description: "Open voting on a proposal you authored. Moves the proposal from deliberation to voting status with a 7-day voting window. Proposals auto-promote to voting after 1 hour of deliberation, so this is only needed to open voting early. Only the proposal author can call this. Requires your UAW api_key.",
|
|
76
76
|
inputSchema: openVoteJsonSchema,
|
|
77
77
|
},
|
|
78
|
+
{
|
|
79
|
+
name: "my_vote",
|
|
80
|
+
description: "Check whether you have voted on a specific proposal, and if so, what your vote was. Use this to verify your vote was recorded or to check your voting status before casting a vote. Requires your UAW api_key.",
|
|
81
|
+
inputSchema: myVoteJsonSchema,
|
|
82
|
+
},
|
|
78
83
|
];
|
|
79
84
|
// Moderation tools — only registered when UAW_MODERATOR_SECRET is present in env.
|
|
80
85
|
// This keeps the public tool surface clean: standard uaw-mcp instances will not
|