Skip to main content
Glama
sweetwisdom

MCP Project Query Server

by sweetwisdom

get_project_info

Retrieve project details including start date, description, investment amount, and current status by providing the project name.

Instructions

根据项目名称查询项目基本信息,包括开始日期、简介、投资金额和当前进度

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
projectNameYes要查询的项目名称

Implementation Reference

  • Core handler logic for the get_project_info tool: retrieves project data via service, formats it into MCP-compatible content blocks (JSON stringified), handles missing projects and errors gracefully.
    async getProjectInfo(projectName: string): Promise<{ content: Array<{ type: "text"; text: string }> }> {
      try {
        const project = await this.projectService.getProjectInfo(projectName);
    
        if (!project) {
          return {
            content: [
              {
                type: "text" as const,
                text: `未找到名为"${projectName}"的项目。`,
              },
            ],
          };
        }
    
        return {
          content: [
            {
              type: "text" as const,
              text: JSON.stringify(project),
            },
          ],
        };
      } catch (error) {
        return {
          content: [
            {
              type: "text" as const,
              text: `查询项目时出错: ${error instanceof Error ? error.message : '未知错误'}`,
            },
          ],
        };
      }
    }
  • Registers the 'get_project_info' MCP tool with name, description, input schema (projectName: string), and delegates to ProjectController.getProjectInfo().
    server.tool(
        'get_project_info',
        '根据项目名称查询项目基本信息,包括开始日期、简介、投资金额和当前进度',
        {
            projectName: z.string().describe('要查询的项目名称'),
        },
        async ({ projectName }) => {
            return await projectController.getProjectInfo(projectName);
        }
    );
  • Input schema for the tool using Zod: requires 'projectName' as string.
    {
        projectName: z.string().describe('要查询的项目名称'),
    },
  • Helper service method that fetches the project by name from the repository, returning null if not found.
    async getProjectInfo(projectName: string): Promise<Project | null> {
      return this.projectRepository.findProjectByName(projectName) || null;
    }

Tool Definition Quality

Score is being calculated. Check back soon.

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/sweetwisdom/mcp-demo'

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