Skip to main content
Glama
IQAIcom
by IQAIcom

GET_WIKI

Retrieve detailed information about a specific wiki from IQ.wiki by its unique ID using the MCP server for AI assistants and applications.

Instructions

Get details about a specific wiki from IQ.wiki by ID

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesThe ID of the wiki to retrieve

Implementation Reference

  • The main handler function for the GET_WIKI tool. It instantiates GetWikiService, calls its execute method with the provided wiki ID, formats the result, and handles any errors gracefully.
    execute: async (params: GetWikiParams) => {
    	try {
    		const service = new GetWikiService();
    		const wiki = await service.execute(params.id);
    
    		return service.format(wiki);
    	} catch (error) {
    		if (error instanceof Error) {
    			console.log(`Error in GET_WIKI tool: ${error.message}`);
    			return `Error retrieving wiki: ${error.message}`;
    		}
    		return "An unknown error occurred while fetching wiki data";
    	}
    },
  • Zod schema defining the required input parameter 'id' (string, non-empty) for the GET_WIKI tool.
    const getWikiParams = z.object({
    	id: z.string().min(1).describe("The ID of the wiki to retrieve"),
    });
  • src/index.ts:17-17 (registration)
    Registers the GET_WIKI tool (imported as getWikiTool) with the FastMCP server instance.
    server.addTool(getWikiTool);
  • src/index.ts:6-6 (registration)
    Imports the GET_WIKI tool definition from src/tools/get-wiki.js for registration.
    import { getWikiTool } from "./tools/get-wiki.js";
  • Supporting service class for GET_WIKI that executes a GraphQL query using WIKI_QUERY to fetch wiki details by ID and formats the output into a readable string.
    export class GetWikiService {
    	async execute(id: string) {
    		try {
    			const response = await client.request(WIKI_QUERY, {
    				id,
    			});
    
    			if (!response.wiki) {
    				throw new Error("Wiki Not found");
    			}
    			return response.wiki;
    		} catch (error: any) {
    			throw new Error(error.message);
    		}
    	}
    	format(wiki: any) {
    		const formattedWiki = dedent`
    			πŸ“œ Wiki Details
    			- Title: ${wiki.title}
    			- Summary: ${wiki.summary}
    
    			πŸ”— Source: ${IQ_BASE_URL}/${wiki.id}
    			πŸ”— Transaction: https://polygonscan.com/tx/${wiki.transactionHash}
    		`;
    
    		return formattedWiki;
    	}
    }
Install Server

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