Skip to main content
Glama
tachibanayu24

jgrants-mcp

get_subsidy_detail

Retrieve detailed information about a specific subsidy by entering its unique subsidy ID to access comprehensive data and requirements.

Instructions

Get detailed information about a specific subsidy. Use the subsidy ID, not the title.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
subsidy_idYesSubsidy ID

Implementation Reference

  • Handler for the 'get_subsidy_detail' tool. Parses arguments using schema, fetches subsidy details from the API, processes attachment metadata without full data, constructs a summary, and returns structured content.
    case "get_subsidy_detail": {
      const args = GetSubsidyDetailSchema.parse(request.params.arguments);
    
      try {
        const response = await fetch(
          `${API_BASE_URL}/subsidies/id/${args.subsidy_id}`
        );
        if (!response.ok) {
          const errorBody = await response.text();
          throw new Error(`API error: ${response.status} - ${errorBody}`);
        }
        const data = (await response.json()) as SubsidyDetailResponse;
    
        // Check result
        if (!data.result || data.result.length === 0) {
          return {
            content: [
              {
                type: "text",
                text: `Subsidy with ID ${args.subsidy_id} was not found.`,
              },
            ],
          };
        }
    
        const subsidyInfo = data.result[0];
    
        // 添付ファイルは軽量メタ情報(index, name, サイズ等)のみ返し、実データは download_attachment で取得
        // Base64 文字列長から概算バイトサイズを計算(デコードコストを回避)
        const calculateBase64Size = (base64: string): number => {
          // 改行などの空白文字を除去(API が 76 文字ごとの改行付きで返すケースに対応)
          const cleanBase64 = base64.replace(/\s+/g, "");
          const paddingCount = cleanBase64.endsWith("==")
            ? 2
            : cleanBase64.endsWith("=")
              ? 1
              : 0;
          return Math.floor((cleanBase64.length * 3) / 4) - paddingCount;
        };
    
        // 添付配列から軽量メタ情報を生成する共通ヘルパー
        const buildAttachmentList = (
          attachments?: Array<{ name: string; data: string }>
        ) =>
          attachments?.map((attachment, index) => ({
            index,
            name: attachment.name,
            sizeBytes: calculateBase64Size(attachment.data),
          })) ?? [];
    
        const applicationGuidelinesAttachments = buildAttachmentList(
          subsidyInfo.application_guidelines
        );
        const outlineOfGrantAttachments = buildAttachmentList(
          subsidyInfo.outline_of_grant
        );
        const applicationFormAttachments = buildAttachmentList(
          subsidyInfo.application_form
        );
    
        const subsidySummary: SubsidyDetailSummary = {
          ...subsidyInfo,
          application_guidelines: {
            count: applicationGuidelinesAttachments.length,
            hasAttachments: applicationGuidelinesAttachments.length > 0,
            attachments: applicationGuidelinesAttachments,
          },
          outline_of_grant: {
            count: outlineOfGrantAttachments.length,
            hasAttachments: outlineOfGrantAttachments.length > 0,
            attachments: outlineOfGrantAttachments,
          },
          application_form: {
            count: applicationFormAttachments.length,
            hasAttachments: applicationFormAttachments.length > 0,
            attachments: applicationFormAttachments,
          },
        };
    
        return {
          content: [
            {
              type: "text",
              text: JSON.stringify(subsidySummary, null, 2),
            },
          ],
          structuredContent: subsidySummary,
        };
      } catch (error) {
        return {
          content: [
            {
              type: "text",
              text: `Error occurred: ${
                error instanceof Error ? error.message : "Unknown error"
              }`,
            },
          ],
        };
      }
    }
  • Zod schema defining the input for 'get_subsidy_detail': requires 'subsidy_id' string.
    const GetSubsidyDetailSchema = z.object({
      subsidy_id: z.string(),
    });
  • index.ts:69-83 (registration)
    Registration of the 'get_subsidy_detail' tool in the list_tools response, including name, description, and input schema.
    {
      name: "get_subsidy_detail",
      description:
        "Get detailed information about a specific subsidy. Use the subsidy ID, not the title.",
      inputSchema: {
        type: "object",
        properties: {
          subsidy_id: {
            type: "string",
            description: "Subsidy ID",
          },
        },
        required: ["subsidy_id"],
      },
    },
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool 'Get[s] detailed information,' which implies a read-only operation, but does not specify permissions, rate limits, error handling, or what 'detailed information' entails. This leaves significant gaps for a tool with no annotation coverage.

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 concise and well-structured with two sentences: the first states the purpose, and the second provides usage guidance. Every sentence adds value without redundancy, making it efficient and front-loaded.

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's low complexity (1 parameter, no output schema, no annotations), the description is adequate but incomplete. It covers the basic purpose and parameter usage, but lacks details on behavioral aspects like permissions or output format, which are needed for full contextual understanding in the absence of annotations.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema description coverage is 100%, with the parameter 'subsidy_id' documented as 'Subsidy ID.' The description adds minimal value beyond the schema by emphasizing 'Use the subsidy ID, not the title,' which clarifies the parameter's purpose but does not provide additional syntax or format details. This meets the baseline for high schema coverage.

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 tool's purpose: 'Get detailed information about a specific subsidy.' It uses a specific verb ('Get') and resource ('subsidy'), but does not explicitly differentiate from sibling tools like 'list_subsidies' beyond the 'specific' qualifier, which is implied but not directly contrasted.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides some usage guidance: 'Use the subsidy ID, not the title.' This implies when to use this tool (for a specific subsidy by ID) versus alternatives, but does not explicitly mention sibling tools or broader contexts. It offers basic direction without clear exclusions or named alternatives.

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/tachibanayu24/jgrants-mcp'

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