Skip to main content
Glama
osulivan

skill4agent MCP Server

install_skill

Install AI skills by providing the skill ID to add new capabilities to AI conversations through the skill4agent MCP Server.

Instructions

Get installation methods for a skill.

Use cases:

  • When you need to install a skill

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
skillIdYesThe skill ID to install. Can be obtained from the results returned by the search_skills or get_skill tool.

Implementation Reference

  • The installSkillHandler function is the main handler for the install_skill tool. It takes a skillId parameter, calls the API client's installSkill method, and returns the installation methods (npx and download) as JSON content.
    export async function installSkillHandler(
      args: z.infer<typeof installSkillSchema>
    ): Promise<{ content: Array<{ type: 'text'; text: string }> }> {
      const api = getAPIClient();
    
      try {
        const result = await api.installSkill({
          skillId: args.skillId,
        });
    
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify(result, null, 2),
            },
          ],
        };
      } catch (error) {
        const message = error instanceof Error ? error.message : 'Failed to get installation info';
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify({
                error: message,
                message: 'Failed to get installation info. Please check: 1. Parameter format is correct 2. Network connection is normal',
              }, null, 2),
            },
          ],
        };
      }
    }
  • The installSkillSchema is a Zod schema that validates the input for the install_skill tool. It requires a skillId string parameter with a description explaining it can be obtained from search_skills or get_skill results.
    export const installSkillSchema = z.object({
      skillId: z.string().describe('The skill ID to install. Can be obtained from the results returned by the search_skills or get_skill tool.'),
    });
  • src/server.ts:48-57 (registration)
    Registration of the install_skill tool with the MCP server. The tool is registered with its name, description, input schema, and handler function that delegates to installSkillHandler.
    server.registerTool(
      'install_skill',
      {
        description: 'Get installation methods for a skill.\n\nUse cases:\n- When you need to install a skill',
        inputSchema: installSkillSchema,
      },
      async (args) => {
        return installSkillHandler(args);
      }
    );
  • TypeScript interfaces for InstallSkillParams (skillId string) and InstallSkillResponse (containing skillId, skillName, and installMethods with npx and download options).
    export interface InstallSkillParams {
      skillId: string;
    }
    
    export interface InstallSkillResponse {
      skillId: string;
      skillName: string;
      installMethods: {
        npx: {
          description: string;
          command: Array<{english_version?: string; chinese_version?: string}>;
          result: string;
        };
        download: {
          description: string;
          url: Array<{english_version?: string; chinese_version?: string}>;
          result: string;
        };
      };
    }
  • The installSkill method in APIClient makes a GET request to /install?skillId={skillId} endpoint and returns the InstallSkillResponse containing installation methods.
    async installSkill(params: InstallSkillParams): Promise<InstallSkillResponse> {
      try {
        const response = await this.client.get<InstallSkillResponse>(
          `/install?skillId=${encodeURIComponent(params.skillId)}`
        );
        return response.data;
      } catch (error) {
        if (axios.isAxiosError(error)) {
          throw this.handleError(error);
        }
        throw new Error('Failed to install skill: Unknown error');
      }
    }
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/osulivan/skill4agent-mcp-server'

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