Skip to main content
Glama

get-connect-uri

Generate a connection URI to link applications with MetaMask wallet for secure blockchain interactions.

Instructions

Get the connect URI to connect to a MetaMask wallet.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Registration of the 'get-connect-uri' MCP tool, defining name, description, input schema (empty), and execute handler function.
    server.addTool({
      name: "get-connect-uri",
      description: "Get the connect URI to connect to a MetaMask wallet.",
      parameters: z.object({}),
      execute: async (_, { log }) => {
        const uri = await getMetaMaskConnectURI(log, wagmiConfig);
        return {
          content: [
            {
              type: "text",
              text: JSONStringify({
                uri,
              }),
            },
          ],
        };
      },
    });
  • Execute handler for 'get-connect-uri' tool: calls helper to get MetaMask connect URI and returns it as structured text content.
    execute: async (_, { log }) => {
      const uri = await getMetaMaskConnectURI(log, wagmiConfig);
      return {
        content: [
          {
            type: "text",
            text: JSONStringify({
              uri,
            }),
          },
        ],
      };
    },
  • Zod input schema for 'get-connect-uri': no parameters required.
    parameters: z.object({}),
  • Helper function implementing the core logic: creates headless MetaMask connector, listens for 'display_uri' event, and resolves the connect URI.
    async function getMetaMaskConnectURI(log: any, wagmiConfig: Config) {
      return new Promise((resolve, reject) => {
        const connectorFn = metaMask({
          headless: true,
        });
        const connector = wagmiConfig._internal.connectors.setup(connectorFn);
        connector.emitter.on("message", (payload) => {
          if (payload.type === "display_uri") {
            const uri = payload.data;
            resolve(uri);
          }
        });
        connector.emitter.on("connect", (payload) => {
          log.debug("connect success!", payload.accounts);
        });
        connector.emitter.on("error", (payload) => {
          log.error(payload.error);
        });
    
        connect(wagmiConfig, { connector })
          .catch((error) => {
            log.error("connect error: ", error);
            log.error(error.stack);
            reject(error);
          });
      });
    }
  • Top-level call to register connect tools, including 'get-connect-uri', during overall tools registration.
    registerConnectTools(server, wagmiConfig);
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the full burden but only states what the tool does without disclosing behavioral traits like whether it requires user interaction, returns a URI format, or has any side effects. It's minimal and lacks crucial operational details.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, clear sentence with no wasted words, efficiently conveying the core purpose. It's appropriately sized and front-loaded, making it easy to understand quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool has no parameters, no annotations, and no output schema, the description is adequate as a basic statement but incomplete for practical use. It doesn't explain what the URI is used for, how it's returned, or integration details, leaving gaps in context.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 0 parameters with 100% coverage, so no parameter documentation is needed. The description doesn't add param info, which is acceptable here, but it could have clarified output semantics, though that's not required for this dimension.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Get') and the resource ('connect URI'), specifying it's for connecting to a MetaMask wallet. However, it doesn't differentiate from sibling tools like 'show-connect-qrcode', which might serve a similar purpose, leaving some ambiguity about uniqueness.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus alternatives, such as 'show-connect-qrcode' or other connection-related tools. The description lacks context about prerequisites or scenarios, offering no help in tool selection.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other 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/Xiawpohr/metamask-mcp'

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