Skip to main content
Glama

updateDomains

Modify allowlisted domains for user access control in the Pollinations Multimodal MCP Server to manage permitted content generation sources.

Instructions

Update domains allowlisted for a user

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
userIdYesThe GitHub user ID
domainsYesThe domains to allowlist
sessionIdYesThe session ID for authentication

Implementation Reference

  • The main handler function for the 'updateDomains' tool. Validates inputs, makes a PUT request to the auth API to update the user's allowlisted domains using the provided JWT access token, and returns the response in MCP format.
    async function updateDomains(params) { const { userId, domains, accessToken } = params; if (!userId || typeof userId !== "string") { throw new Error("User ID is required and must be a string"); } if (!Array.isArray(domains)) { throw new Error("Domains must be an array of strings"); } if (!accessToken || typeof accessToken !== "string") { throw new Error("Access token is required and must be a string"); } try { // Call the auth.pollinations.ai domains endpoint with JWT const response = await fetch( `${AUTH_API_BASE_URL}/api/user/${userId}/domains`, { method: "PUT", headers: { "Content-Type": "application/json", Authorization: `Bearer ${accessToken}`, }, body: JSON.stringify({ domains }), }, ); if (!response.ok) { throw new Error(`Failed to update domains: ${response.statusText}`); } // Get the updated domains data const updatedData = await response.json(); // Return the response in MCP format return createMCPResponse([createTextContent(updatedData, true)]); } catch (error) { console.error("Error updating domains:", error); throw error; } }
  • Registration of the 'updateDomains' tool in the authTools export array, including the tool name, description, Zod input schema for validation, and reference to the handler function.
    [ "updateDomains", "Update domains allowlisted for a user using JWT authentication", { userId: z.string().describe("The GitHub user ID"), domains: z.array(z.string()).describe("The domains to allowlist"), accessToken: z .string() .describe("The JWT access token from exchangeToken"), }, updateDomains, ],

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/tusharpatil2912/pollinations-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server