Skip to main content
Glama

GET_USER_EDITED_WIKIS

Retrieve wikis edited by a specific user on IQ.wiki using their Ethereum address, with optional time frame filtering for precise results.

Instructions

Get wikis edited by a specific user on IQ.wiki

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesThe Ethereum address of the user
timeFrameSecondsNoOptional time frame in seconds to filter results

Implementation Reference

  • The execute function serving as the main handler for the GET_USER_EDITED_WIKIS tool. It instantiates the service, executes the query with parameters, formats the result, and handles errors.
    execute: async (params: GetUserEditedWikisParams) => { try { const service = new GetUserEditedWikisService(); const wikis = await service.execute(params.id, params.timeFrameSeconds); return service.format(wikis); } catch (error) { if (error instanceof Error) { console.log(`Error in GET_USER_EDITED_WIKIS tool: ${error.message}`); return `Error retrieving user edited wikis: ${error.message}`; } return "An unknown error occurred while fetching user edited wikis"; } },
  • Zod schema defining the input parameters for the tool: user ID (Ethereum address) and optional time frame.
    const getUserEditedWikisParams = z.object({ id: z.string().min(1).describe("The Ethereum address of the user"), timeFrameSeconds: z .number() .optional() .describe("Optional time frame in seconds to filter results"), });
  • src/index.ts:17-21 (registration)
    Registration of the getUserEditedWikisTool (line 19) along with other tools to the FastMCP server.
    server.addTool(getWikiTool); server.addTool(getUserCreatedWikisTool); server.addTool(getUserEditedWikisTool); server.addTool(getWikiActivitiesTool); server.addTool(searchWikiTool);
  • Core logic in GetUserEditedWikisService.execute: performs GraphQL query for user's edited wikis, filters for actual edits using metadata, handles time frame (with limitations), and returns filtered wikis.
    async execute(id: string, timeFrameSeconds?: number) { try { const response: any = await client.request(USER_EDITED_WIKIS_QUERY, { id, }); if (!response.userById) { throw new Error("user does not exist"); } if (!response.userById.wikisEdited.activity) { throw new Error("user has not edited any wikis"); } let wikis = response.userById.wikisEdited.activity[0].content; // Since the updated field is null for edited wikis, we need to detect edits by metadata // Filter out wikis that aren't actually edits (they should have previous_cid in metadata) wikis = wikis.filter((wiki: any) => { // Check for edit-specific metadata const hasMetadata = wiki.metadata && Array.isArray(wiki.metadata); if (!hasMetadata) return false; // Look for previous_cid which indicates this is an edit return wiki.metadata.some((meta: any) => meta.id === "previous_cid"); }); // Filter by time if timeFrameSeconds is provided // Since we don't have updated timestamps, we'll use timestamp from references if available if (timeFrameSeconds && wikis.length > 0) { const now = new Date(); const timeLimit = new Date(now.getTime() - timeFrameSeconds * 1000); // We need to skip time filtering because we don't have reliable timestamps // Just inform the user that we can't filter by time if (wikis.length === 0) { // Convert seconds to a human-readable format for the error message const timeFrameText = timeFrameSeconds >= 86400 ? `${timeFrameSeconds / 86400} day(s)` : timeFrameSeconds >= 3600 ? `${timeFrameSeconds / 3600} hour(s)` : `${timeFrameSeconds / 60} minute(s)`; throw new Error(`No edited wikis found in the last ${timeFrameText}`); } } return wikis; } catch (error: any) { throw new Error(error.message); } }
  • Format method of the service that transforms the raw wiki data into a human-readable string with details on edits, timestamps, changes, and links.
    format(wikis: any) { return wikis .map((wiki: any) => { // Find edit-related metadata const wordsChanged = wiki.metadata.find((m: any) => m.id === "words-changed")?.value || "Unknown"; const percentChanged = wiki.metadata.find((m: any) => m.id === "percent-changed")?.value || "Unknown"; const blocksChanged = wiki.metadata.find((m: any) => m.id === "blocks-changed")?.value || "Unknown"; // Get the date from updated or fallback to a reasonable alternative const date = new Date(wiki.updated || wiki.created); const formattedDate = date.toLocaleString(); return dedent` 📜 Wiki Edited - Title: ${wiki.title} - Summary: ${wiki.summary} - Edited: ${formattedDate} - Changes: ${wordsChanged} words (${percentChanged}%) - Modified sections: ${blocksChanged} 🔗 Source: ${IQ_REVISION_URL}/${wiki.ipfs} 🔗 Transaction: https://polygonscan.com/tx/${wiki.transactionHash} `; }) .join("\n\n"); } }

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/IQAIcom/mcp-iqwiki'

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