Skip to main content
Glama

updateDomains

Manage allowlisted domains for a user by updating the list of approved domains for secure API access within the Pollinations Multimodal MCP Server.

Instructions

Update domains allowlisted for a user

Input Schema

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

Implementation Reference

  • The primary handler function for the 'updateDomains' MCP tool. It performs input validation, sends a PUT request to the authentication API to update the user's allowlisted domains using JWT, handles errors, and returns an MCP-formatted response with the updated data.
    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; } }
  • Zod schema defining the input parameters for the 'updateDomains' tool: userId (string), domains (array of strings), and accessToken (string). Used for validation during tool invocation.
    { 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"), },
  • The registration entry for the 'updateDomains' tool within the authTools array. Includes the tool name, description (with Gen-Z instructions), input schema, and reference to the handler function. This array is later spread into the main toolDefinitions and registered with the MCP server.
    [ "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, ],

Other Tools

Related Tools

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