Skip to main content
Glama

Find LLM SDK calls in code

promptguard_scan_code
Read-onlyIdempotent

Analyze code for LLM SDK usage patterns (OpenAI, Anthropic, Cohere, Google Gemini, Bedrock). Detects import statements and client instantiations via pattern matching. When to use: After generating new code that uses LLM SDKs, when reviewing pull requests, or when auditing a codebase for security coverage gaps.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "code": "<code>"
    },
    "name": "promptguard_scan_code"
  }
}

Input Schema

NameRequiredDescriptionDefault
codeYesThe code content to analyze for LLM SDK usage

Output Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • changedOutput schema / anyOf
      Previous value: -[
      -  {
      -    "properties": {
      -      "kind": {
      -        "const": "code"
      -      },
      -      "providers": {
      -        "items": {
      -          "properties": {
      -            "count": {
      -              "type": "integer"
      -            },
      -            "instances": {
      -              "items": {
      -                "properties": {
      -                  "line": {
      -                    "type": "integer"
      -                  },
      -                  "match": {
      -                    "type": "string"
      -                  }
      -                },
      -                "required": [
      -                  "line",
      -                  "match"
      -                ],
      -                "type": "object"
      -              },
      -              "type": "array"
      -            },
      -            "provider": {
      -              "type": "string"
      -            }
      -          },
      -          "required": [
      -            "provider",
      -            "count",
      -            "instances"
      -          ],
      -          "type": "object"
      -        },
      -        "type": "array"
      -      },
      -      "recommendation": {
      -        "type": "string"
      -      },
      -      "summary": {
      -        "type": "string"
      -      },
      -      "totalDetections": {
      -        "type": "integer"
      -      }
      -    },
      -    "required": [
      -      "kind",
      -      "summary",
      -      "providers",
      -      "totalDetections"
      -    ],
      -    "type": "object"
      -  },
      -  {
      -    "properties": {
      -      "error": {
      -        "type": [
      -          "string",
      -          "object"
      -        ]
      -      },
      -      "kind": {
      -        "const": "error"
      -      }
      -    },
      -    "required": [
      -      "kind",
      -      "error"
      -    ],
      -    "type": "object"
      -  }
      -]New value: +[
      +  {
      +    "properties": {
      +      "kind": {
      +        "const": "code"
      +      },
      +      "providers": {
      +        "items": {
      +          "properties": {
      +            "count": {
      +              "type": "integer"
      +            },
      +            "instances": {
      +              "items": {
      +                "properties": {
      +                  "line": {
      +                    "type": "integer"
      +                  },
      +                  "match": {
      +                    "type": "string"
      +                  }
      +                },
      +                "required": [
      +                  "line",
      +                  "match"
      +                ],
      +                "type": "object"
      +              },
      +              "type": "array"
      +            },
      +            "provider": {
      +              "type": "string"
      +            }
      +          },
      +          "required": [
      +            "provider",
      +            "count",
      +            "instances"
      +          ],
      +          "type": "object"
      +        },
      +        "type": "array"
      +      },
      +      "recommendation": {
      +        "type": "string"
      +      },
      +      "summary": {
      +        "type": "string"
      +      },
      +      "totalDetections": {
      +        "type": "integer"
      +      }
      +    },
      +    "required": [
      +      "kind",
      +      "summary",
      +      "providers",
      +      "totalDetections"
      +    ],
      +    "type": "object"
      +  },
      +  {
      +    "properties": {
      +      "code": {
      +        "type": "string"
      +      },
      +      "error": {
      +        "type": "string"
      +      },
      +      "kind": {
      +        "const": "error"
      +      }
      +    },
      +    "required": [
      +      "kind",
      +      "error"
      +    ],
      +    "type": "object"
      +  }
      +]
  2. Changed3 schema fields changed
    • addedOutput schema / anyOf
      Added value: +[
      +  {
      +    "properties": {
      +      "kind": {
      +        "const": "code"
      +      },
      +      "providers": {
      +        "items": {
      +          "properties": {
      +            "count": {
      +              "type": "integer"
      +            },
      +            "instances": {
      +              "items": {
      +                "properties": {
      +                  "line": {
      +                    "type": "integer"
      +                  },
      +                  "match": {
      +                    "type": "string"
      +                  }
      +                },
      +                "required": [
      +                  "line",
      +                  "match"
      +                ],
      +                "type": "object"
      +              },
      +              "type": "array"
      +            },
      +            "provider": {
      +              "type": "string"
      +            }
      +          },
      +          "required": [
      +            "provider",
      +            "count",
      +            "instances"
      +          ],
      +          "type": "object"
      +        },
      +        "type": "array"
      +      },
      +      "recommendation": {
      +        "type": "string"
      +      },
      +      "summary": {
      +        "type": "string"
      +      },
      +      "totalDetections": {
      +        "type": "integer"
      +      }
      +    },
      +    "required": [
      +      "kind",
      +      "summary",
      +      "providers",
      +      "totalDetections"
      +    ],
      +    "type": "object"
      +  },
      +  {
      +    "properties": {
      +      "error": {
      +        "type": [
      +          "string",
      +          "object"
      +        ]
      +      },
      +      "kind": {
      +        "const": "error"
      +      }
      +    },
      +    "required": [
      +      "kind",
      +      "error"
      +    ],
      +    "type": "object"
      +  }
      +]
    • removedOutput schema / properties
      Removed value: -{
      -  "kind": {
      -    "const": "code"
      -  },
      -  "providers": {
      -    "items": {
      -      "properties": {
      -        "count": {
      -          "type": "integer"
      -        },
      -        "instances": {
      -          "items": {
      -            "properties": {
      -              "line": {
      -                "type": "integer"
      -              },
      -              "match": {
      -                "type": "string"
      -              }
      -            },
      -            "required": [
      -              "line",
      -              "match"
      -            ],
      -            "type": "object"
      -          },
      -          "type": "array"
      -        },
      -        "provider": {
      -          "type": "string"
      -        }
      -      },
      -      "required": [
      -        "provider",
      -        "count",
      -        "instances"
      -      ],
      -      "type": "object"
      -    },
      -    "type": "array"
      -  },
      -  "recommendation": {
      -    "type": "string"
      -  },
      -  "summary": {
      -    "type": "string"
      -  },
      -  "totalDetections": {
      -    "type": "integer"
      -  }
      -}
    • removedOutput schema / required
      Removed value: -[
      -  "kind",
      -  "summary",
      -  "providers",
      -  "totalDetections"
      -]
  3. First observed

TDQS

A3.8/5.0
Behavior3/5

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

Annotations already declare readOnlyHint, idempotentHint, destructiveHint=false and openWorldHint=false, so the safety profile is covered. The description does add useful behavior beyond them: detection is pattern matching scoped to import statements and client instantiations, which implies it will miss indirect or raw-HTTP usage. It stops short of stating false-positive/false-negative characteristics or language 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?

Two sentences with no waste: the capability sentence is front-loaded with providers and mechanism, and the usage sentence follows cleanly. Nothing repeats the title or annotations.

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

Completeness4/5

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

For a simple one-parameter read tool with an output schema and full annotation coverage, the description supplies the purpose, the detection approach, the provider scope, and usage contexts. What is missing is the practical boundary of the input (snippet vs. whole file) and a cue to the sibling text-scanning tool.

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 single parameter has 100% schema description coverage ("The code content to analyze for LLM SDK usage"), so the schema already carries the semantics and the baseline is 3. The description adds no further detail such as whether a snippet, a file, or a whole repository is expected, which is the main ambiguity for this parameter.

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 states a specific verb and resource ("analyze code for LLM SDK usage patterns") and enumerates the SDKs it recognizes, plus the detection mechanism (import statements and client instantiations). It does not explicitly distinguish itself from the sibling promptguard_scan_text, leaving the code-vs-text split implicit in the name and wording.

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

Usage Guidelines4/5

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

A dedicated "When to use" clause names three concrete contexts: post-generation of LLM-SDK code, PR review, and security coverage auditing. There are no explicit exclusions or a pointer to the sibling scan_text, so the agent must infer when the text-scanning alternative applies.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.