import { z } from "zod";
import { experimental_PaidMcpAgent as PaidMcpAgent } from "@stripe/agent-toolkit/cloudflare";
export function getMunicipalityCodesTool(agent: PaidMcpAgent<Env, any, any>) {
const server = agent.server;
// @ts-ignore
server.tool(
"get_municipality_codes",
"Retrieve complete municipal code structure. Essential for understanding local amendments to model codes. Use when you need the full regulatory framework.",
{
municipality: z.string().describe("Municipality name and state (e.g., 'Atlanta, GA', 'Miami-Dade County, FL')"),
includeAmendments: z.boolean().optional().describe("Include local amendments and modifications to model codes"),
codeTypes: z.array(z.enum(["building", "zoning", "electrical", "plumbing", "fire", "mechanical", "all"])).optional().describe("Specific code types to retrieve"),
},
async ({ municipality, includeAmendments, codeTypes }: {
municipality: string;
includeAmendments?: boolean;
codeTypes?: string[];
}) => {
// This would integrate with Municode API to retrieve the complete code structure
// For now, return a structured response indicating the request parameters
const requestParams = {
municipality,
includeAmendments: includeAmendments || true,
codeTypes: codeTypes || ["all"]
};
return {
content: [
{
type: "text",
text: `Municipal Code Structure Request\n\nMunicipality: ${requestParams.municipality}\nInclude Amendments: ${requestParams.includeAmendments}\nCode Types: ${requestParams.codeTypes.join(", ")}\n\nThis tool would retrieve the complete municipal code structure including:\n\n- Adopted model codes and editions\n- Local amendments and modifications\n- Administrative procedures\n- Enforcement policies\n- Fee schedules\n- Professional requirements\n- Inspection protocols\n- Appeal processes\n\nThis comprehensive view is essential for understanding the complete regulatory framework and ensuring compliance with all applicable requirements.`
}
]
};
}
);
}