Skip to main content
Glama

get-connect-uri

Generate a connection URI to link with a MetaMask wallet for secure blockchain interactions without exposing private keys.

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' tool in the registerConnectTools function, including schema (empty parameters) and inline execute handler that calls getMetaMaskConnectURI.
    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);
        return {
          content: [
            {
              type: "text",
              text: JSONStringify({
                uri,
              }),
            },
          ],
        }
      },
    });
  • The core handler function that generates the MetaMask connect URI by setting up a headless metaMask connector with wagmi, listening for the display_uri message, and initiating a connection.
    async function getMetaMaskConnectURI(log: any) {
      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)
            reject(error)
          })
      })
    }
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the tool retrieves a URI but does not explain what the URI is used for, whether it involves authentication, rate limits, or side effects. This leaves significant gaps in understanding the tool's behavior.

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, efficient sentence that directly states the tool's purpose without unnecessary words. It is front-loaded and appropriately sized for a simple tool.

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 and no output schema, the description is minimally adequate but lacks depth. It does not explain what the connect URI is, how it should be used, or what the expected outcome is, which could hinder an agent's ability to use it effectively 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 does not add parameter details, which is acceptable here, but it could have clarified if any implicit inputs are required, such as wallet state.

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 its purpose to connect to a MetaMask wallet. However, it does not differentiate from sibling tools like 'show-connect-qrcode', which might serve a similar connection purpose, leaving some ambiguity.

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?

The description provides no guidance on when to use this tool versus alternatives, such as 'show-connect-qrcode' or 'disconnect'. It lacks context on prerequisites or scenarios, leaving the agent to infer usage without explicit direction.

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/mcpilot'

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