Skip to main content
Glama

get_sip

Retrieve complete Stacks Improvement Proposal content by number, including Clarity smart contract code for blockchain development standards.

Instructions

Get the complete content of a specific SIP (Stacks Improvement Proposal) by number, including any Clarity smart contract code.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sipNumberYesThe SIP number (e.g., '009' for SIP-009 NFT standard, '010' for SIP-010 FT standard)

Implementation Reference

  • The execute function that implements the core logic of the 'get_sip' tool by calling the getSIPContent helper with the sipNumber argument and formatting the response.
    execute: async (args) => {
      const content = await getSIPContent(args.sipNumber);
      return { text: content, type: "text" };
    },
  • Zod input schema defining the required 'sipNumber' parameter as a string.
    parameters: z.object({
      sipNumber: z.string().describe("The SIP number (e.g., '009' for SIP-009 NFT standard, '010' for SIP-010 FT standard)"),
    }),
  • src/server.ts:66-76 (registration)
    Registration of the 'get_sip' tool on the FastMCP server using server.addTool method.
    server.addTool({
      name: "get_sip",
      description: "Get the complete content of a specific SIP (Stacks Improvement Proposal) by number, including any Clarity smart contract code.",
      parameters: z.object({
        sipNumber: z.string().describe("The SIP number (e.g., '009' for SIP-009 NFT standard, '010' for SIP-010 FT standard)"),
      }),
      execute: async (args) => {
        const content = await getSIPContent(args.sipNumber);
        return { text: content, type: "text" };
      },
    });
  • Core helper function that reads and formats the content from the SIP directory, including markdown docs and Clarity contract files.
    export const getSIPContent = async (sipNumber: string): Promise<string> => {
      try {
        const sipDir = pathJoin(stacksClarityStandardsDir, `sip-${sipNumber.padStart(3, "0")}`);
        
        if (!fs.existsSync(sipDir)) {
          return `SIP-${sipNumber} directory not found`;
        }
        
        const files = fs.readdirSync(sipDir);
        const mdFiles = files.filter((file) => file.endsWith(".md"));
        const clarFiles = files.filter((file) => file.endsWith(".clar"));
        
        if (mdFiles.length === 0 && clarFiles.length === 0) {
          return `No documentation or Clarity files found for SIP-${sipNumber}`;
        }
        
        let content = `# SIP-${sipNumber.padStart(3, "0")}\n\n`;
        
        // Read markdown documentation first
        for (const file of mdFiles) {
          const filePath = pathJoin(sipDir, file);
          const fileContent = await readFile(filePath, "utf-8");
          content += `## ${file}\n\n${fileContent}\n\n---\n\n`;
        }
        
        // Read Clarity contract files
        for (const file of clarFiles) {
          const filePath = pathJoin(sipDir, file);
          const fileContent = await readFile(filePath, "utf-8");
          content += `## Clarity Contract: ${file}\n\n\`\`\`clarity\n${fileContent}\n\`\`\`\n\n---\n\n`;
        }
        
        return content;
      } catch (error) {
        return `Error reading SIP-${sipNumber}: ${error}`;
      }
    };

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/exponentlabshq/stacks-clarity-mcp'

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