Skip to main content
Glama
matthewdcage

PBS MCP AI Enabled API Server

pbs_api

Retrieve Australian Pharmaceutical Benefits Scheme (PBS) data on medicines, pricing, and availability through API endpoints for healthcare information access.

Instructions

Access the Australian Pharmaceutical Benefits Scheme (PBS) API to retrieve information about medicines, pricing, and availability.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
endpointYesThe specific PBS API endpoint to access (e.g., "prescribers", "item-overview")
methodNoHTTP method to use (GET is recommended for most PBS API operations)GET
paramsNoQuery parameters to include in the request (e.g., {"get_latest_schedule_only": "true"})
subscriptionKeyNoCustom subscription key (if not provided, the default public key will be used)
timeoutNoRequest timeout in milliseconds

Implementation Reference

  • Core handler function that executes the pbs_api tool: constructs and sends HTTP requests to the PBS API, formats responses and handles errors.
    export async function runPbsApiTool(args: z.infer<typeof PbsApiToolSchema>) {
      try {
        const endpoint = args.endpoint || '';
        console.error(`Accessing PBS API endpoint: ${args.method} ${endpoint}`);
        
        // Use the provided subscription key or fall back to the default
        const subscriptionKey = args.subscriptionKey || DEFAULT_SUBSCRIPTION_KEY;
        
        // Construct the full URL
        const url = constructUrl(endpoint);
        
        // Configure request
        const config: AxiosRequestConfig = {
          method: args.method,
          url: url,
          headers: {
            'Subscription-Key': subscriptionKey,
            'Accept': 'application/json'
          },
          params: args.params || {},
          timeout: args.timeout
        };
        
        // Make the request
        const response = await axios(config);
        
        return formatResponse(response);
      } catch (error) {
        console.error('PBS API error:', error);
        return formatErrorResponse(error);
      }
    } 
  • Zod schema defining the input parameters for the pbs_api tool.
    export const PbsApiToolSchema = z.object({
      endpoint: z.string().describe('The specific PBS API endpoint to access (e.g., "prescribers", "item-overview")'),
      method: z.enum(['GET', 'POST']).default('GET')
        .describe('HTTP method to use (GET is recommended for most PBS API operations)'),
      params: z.record(z.string()).optional()
        .describe('Query parameters to include in the request (e.g., {"get_latest_schedule_only": "true"})'),
      subscriptionKey: z.string().optional()
        .describe('Custom subscription key (if not provided, the default public key will be used)'),
      timeout: z.number().default(30000)
        .describe('Request timeout in milliseconds')
    });
  • Registers the pbs_api tool with its name, description, and JSON input schema for MCP.
    export const pbsApiTools = [
      {
        name: pbsApiToolName,
        description: pbsApiToolDescription,
        inputSchema: {
          type: "object",
          properties: {
            endpoint: {
              type: "string",
              description: 'The specific PBS API endpoint to access (e.g., "prescribers", "item-overview")'
            },
            method: {
              type: "string",
              enum: ["GET", "POST"],
              default: "GET",
              description: 'HTTP method to use (GET is recommended for most PBS API operations)'
            },
            params: {
              type: "object",
              additionalProperties: {
                type: "string"
              },
              description: 'Query parameters to include in the request (e.g., {"get_latest_schedule_only": "true"})'
            },
            subscriptionKey: {
              type: "string",
              description: 'Custom subscription key (if not provided, the default public key will be used)'
            },
            timeout: {
              type: "number",
              default: 30000,
              description: 'Request timeout in milliseconds'
            }
          },
          required: ["endpoint"]
        }
      }
    ];
  • Maps the pbs_api tool name to its handler function (wrapper around runPbsApiTool).
    export const pbsApiToolHandlers = {
      [pbsApiToolName]: async (params: unknown) => {
        // Type cast params to the expected type
        const typedParams = params as z.infer<typeof PbsApiToolSchema>;
        return await runPbsApiTool(typedParams);
      }
    };
  • src/index.ts:20-25 (registration)
    Main server creation that registers the pbsApiTools and pbsApiToolHandlers for the MCP server.
    const server = createMCPServer(
      "pbs-mcp-standalone",
      "1.0.0",
      pbsApiTools,
      pbsApiToolHandlers
    );
  • Exports the tool name 'pbs_api' and its description.
    export const pbsApiToolName = "pbs_api";
    export const pbsApiToolDescription = 
      "Access the Australian Pharmaceutical Benefits Scheme (PBS) API to retrieve information about medicines, pricing, and availability.";
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 mentions retrieving information, implying a read operation, but doesn't cover critical aspects like authentication requirements (hinted at by the subscriptionKey parameter), rate limits, error handling, or response formats. This is inadequate for a 5-parameter API tool.

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 a single, efficient sentence that directly states the tool's purpose without unnecessary details. It's front-loaded and wastes no words, making it highly concise and well-structured.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (5 parameters, no output schema, no annotations), the description is incomplete. It doesn't explain return values, error conditions, or behavioral traits like authentication or rate limits. This leaves significant gaps for an AI agent to use the tool effectively.

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?

Schema description coverage is 100%, so the schema fully documents all parameters. The description adds no specific parameter semantics beyond the general API context. Baseline 3 is appropriate when the schema does the heavy lifting.

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: 'Access the Australian Pharmaceutical Benefits Scheme (PBS) API to retrieve information about medicines, pricing, and availability.' It specifies the verb ('access'), resource ('PBS API'), and scope ('medicines, pricing, and availability'). However, it doesn't differentiate from siblings (none exist), so it's not a perfect 5.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives. It lacks context about prerequisites (e.g., API access, authentication needs) or typical use cases. With no siblings, differentiation isn't needed, but general usage context is missing.

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/matthewdcage/pbs-mcp-server'

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