Skip to main content
Glama
RSS3-Network

RSS3 MCP Server

Official
by RSS3-Network

API-getEpochAPYSnapshots

Retrieve historical APY snapshots for specific epochs to analyze yield performance over time.

Instructions

Retrieve snapshots of epoch APY.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Generic handler for all API tools, including 'API-getEpochAPYSnapshots'. Matches tool name to OpenAPI operation via openApiLookup and executes via HttpClient.
    server.setRequestHandler(CallToolRequestSchema, async (request) => {
    	// console.error("call tool", request.params);
    	const { name, arguments: params } = request.params;
    
    	console.error("name", name);
    
    	if (name === "API-get-input-schema") {
    		for (const mcpToolWithClient of mcpToolWithClients) {
    			for (const [toolName, def] of Object.entries(
    				mcpToolWithClient.mcpTools.tools,
    			)) {
    				for (const method of def.methods) {
    					const toolNameWithMethod = `${toolName}-${method.name}`;
    					const truncatedToolName = toolNameWithMethod.slice(0, 64);
    					if (truncatedToolName === params.toolName) {
    						return {
    							content: [
    								{ type: "text", text: JSON.stringify(method.inputSchema) },
    							],
    						};
    					}
    				}
    			}
    		}
    		throw new Error(`Method ${params.toolName} not found`);
    	}
    
    	// find operation
    	const mcpToolWithClient = mcpToolWithClients.find(
    		(t) => t.mcpTools.openApiLookup[name],
    	);
    	if (!mcpToolWithClient) {
    		throw new Error(`Method ${name} not found`);
    	}
    
    	const operation = mcpToolWithClient.mcpTools.openApiLookup[name];
    
    	// execute
    	try {
    		const response = await mcpToolWithClient.client.executeOperation(
    			operation,
    			params,
    		);
    		return {
    			content: [
    				{
    					type: "text", // currently this is the only type that seems to be used by mcp server
    					text: JSON.stringify(response.data), // TODO: pass through the http status code text?
    				},
    			],
    		};
    	} catch (error) {
    		console.error("Error in tool call", error);
    		if (error instanceof HttpClientError) {
    			console.error(
    				"HttpClientError encountered, returning structured error",
    				error,
    			);
    			const data = error.data?.response?.data ?? error.data ?? {};
    			return {
    				content: [
    					{
    						type: "text",
    						text: JSON.stringify({
    							status: "error", // TODO: get this from http status code?
    							...(typeof data === "object" ? data : { data: data }),
    						}),
    					},
    				],
    			};
    		}
    		throw error;
    	}
    });
  • index.js:100-147 (registration)
    Dynamically registers and lists all tools, including 'API-getEpochAPYSnapshots', by generating names from OpenAPI tool definitions as `${toolName}-${method.name}`.
    server.setRequestHandler(ListToolsRequestSchema, async () => {
    	console.error("list tools");
    	/**
    	 * @typedef {import("@modelcontextprotocol/sdk/types.js").Tool} Tool
    	 * @type {Tool[]}
    	 */
    	const tools = [];
    
    	for (const mcpToolWithClient of mcpToolWithClients) {
    		for (const [toolName, def] of Object.entries(
    			mcpToolWithClient.mcpTools.tools,
    		)) {
    			for (const method of def.methods) {
    				console.error("method", method);
    				const toolNameWithMethod = `${toolName}-${method.name}`;
    				const truncatedToolName = toolNameWithMethod.slice(0, 64);
    				const trimmedDescription = method.description.split("Error")[0].trim();
    				tools.push({
    					name: truncatedToolName,
    					description: trimmedDescription,
    					inputSchema: {
    						type: "object",
    						properties: {},
    					},
    				});
    			}
    		}
    	}
    
    	tools.unshift({
    		name: "API-get-input-schema",
    		description:
    			"Get the input schema for a given API. We should always use this tool to get the input schema for a given API before calling the API.",
    		inputSchema: {
    			type: "object",
    			properties: {
    				toolName: {
    					type: "string",
    					description: "The name of the tool to get the input schema for",
    				},
    			},
    		},
    	});
    
    	console.error("tools", tools);
    
    	return { tools };
    });
  • Converts fetched OpenAPI specifications to MCP tools and clients used for dynamic tool lookup and execution.
    const converterWithClients = openApiSpecs.map((o) => {
    	const converter = new OpenAPIToMCPConverter(o.spec);
    	return {
    		converter,
    		client: o.client,
    	};
    });
    const mcpToolWithClients = converterWithClients.map((cwc) => {
    	const mcpTools = cwc.converter.convertToMCPTools();
    	return {
    		mcpTools,
    		client: cwc.client,
    	};
    });

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/RSS3-Network/mcp-server-rss3'

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