We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/Xiawpohr/mcpilot'
If you have feedback or need assistance with the MCP directory API, please join our Discord server
import { FastMCP } from "fastmcp";
import { z } from "zod";
import { call } from "@wagmi/core"
import { wagmiConfig } from "../wagmi-config.js";
import { Address, TransactionExecutionError } from "viem";
import { JSONStringify } from "../utils/json-stringify.js";
export function registerCallTools(server: FastMCP): void {
server.addTool({
name: "call",
description: "Executing a new message call immediately without submitting a transaction to the network",
parameters: z.object({
to: z.string(),
value: z.coerce.number().optional(),
data: z.string(),
}),
execute: async (args) => {
try {
const to = args.to as Address
const value = args.value ? BigInt(args.value) : undefined
const data = args.data as Address
const result = await call(wagmiConfig, {
to,
value,
data,
})
return {
content: [
{
type: "text",
text: JSONStringify({
hash: result
}),
},
],
}
} catch (error) {
if (error instanceof TransactionExecutionError) {
return {
content: [
{
type: "text",
text: error.cause.message,
}
]
}
}
return {
content: [
{
type: "text",
text: (error as Error).message,
}
]
}
}
},
});
};