Skip to main content
Glama

get_asset_content

Retrieve raw content from Spark assets like prompts, skills, and agent configurations. Access inline content directly for AI development workflows.

Instructions

Get the raw content of a Spark asset (prompt text, skill instructions, agent config). Best for prompts and skills that have inline content.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
slugYesAsset slug

Implementation Reference

  • The main handler function for get_asset_content that fetches an asset by slug and returns its raw content. It handles prompt chains (concatenating steps), assets with inline_content, and falls back to description.
    async ({ slug }) => {
      const asset = await sparkApi<Asset>(`/assets/${slug}`);
    
      // For prompt chains, concatenate steps
      if (asset.chain_steps?.length) {
        const steps = asset.chain_steps
          .sort((a, b) => a.order - b.order)
          .map((s) => `## Step ${s.order}: ${s.title}\n\n${s.content}`)
          .join("\n\n---\n\n");
        return { content: [{ type: "text" as const, text: steps }] };
      }
    
      // For assets with inline content
      if (asset.inline_content) {
        return {
          content: [{ type: "text" as const, text: asset.inline_content }],
        };
      }
    
      // Fallback to description
      return {
        content: [
          {
            type: "text" as const,
            text: asset.description_md || asset.short_description,
          },
        ],
      };
    }
  • src/index.ts:276-311 (registration)
    Registration of the get_asset_content tool with its name, description, input schema (slug parameter), and handler function.
    server.tool(
      "get_asset_content",
      "Get the raw content of a Spark asset (prompt text, skill instructions, agent config). Best for prompts and skills that have inline content.",
      {
        slug: z.string().describe("Asset slug"),
      },
      async ({ slug }) => {
        const asset = await sparkApi<Asset>(`/assets/${slug}`);
    
        // For prompt chains, concatenate steps
        if (asset.chain_steps?.length) {
          const steps = asset.chain_steps
            .sort((a, b) => a.order - b.order)
            .map((s) => `## Step ${s.order}: ${s.title}\n\n${s.content}`)
            .join("\n\n---\n\n");
          return { content: [{ type: "text" as const, text: steps }] };
        }
    
        // For assets with inline content
        if (asset.inline_content) {
          return {
            content: [{ type: "text" as const, text: asset.inline_content }],
          };
        }
    
        // Fallback to description
        return {
          content: [
            {
              type: "text" as const,
              text: asset.description_md || asset.short_description,
            },
          ],
        };
      }
    );
  • The Asset interface defining the structure of asset data returned from the Spark API, including fields like inline_content and chain_steps used by get_asset_content.
    interface Asset extends AssetListItem {
      description_md: string;
      inline_content?: string | null;
      version: string;
      files: { filename: string; size_bytes: number }[];
      bundle_items?: { asset_title: string; asset_slug: string; asset_type: string; role: string }[];
      chain_steps?: { title: string; content: string; order: number }[];
      external_source_name?: string | null;
      external_source_url?: string | null;
    }
  • The sparkApi helper function that makes HTTP requests to the Spark API, used by get_asset_content to fetch asset data.
    async function sparkApi<T = unknown>(path: string): Promise<T> {
      const url = `${SPARK_API}${path}`;
      const res = await fetch(url, {
        headers: { Accept: "application/json" },
      });
      if (!res.ok) {
        const text = await res.text().catch(() => res.statusText);
        throw new Error(`Spark API ${res.status}: ${text}`);
      }
      return res.json() as Promise<T>;
    }

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/entire-vc/evc-spark-mcp'

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