Tools Reference
Complete reference for all 5 MCP tools provided by snippets-mcp.
Snippets-mcp provides 5 MCP tools for full CRUD operations on GitHub Gists.
list_snippets
List code snippets with optional filtering.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
visibility | string | no | Filter: all, public, or private |
language | string | no | Filter by programming language (e.g., Go, Python) |
search | string | no | Search term in snippet description |
tag | string | no | Filter by hashtag (e.g., go matches #go) |
limit | integer | no | Maximum results (default: 30) |
offset | integer | no | Pagination offset |
Example Request
{
"visibility": "private",
"language": "Go",
"tag": "utility",
"limit": 10
}
Example Response
{
"snippets": [
{
"id": "abc123",
"description": "String helpers #go #utility",
"tags": ["go", "utility"],
"files": ["strings.go"],
"public": false,
"updated_at": "2025-01-15T10:00:00Z"
}
],
"total": 42
}
get_snippet
Retrieve full content of a snippet by ID.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id | string | yes | Gist ID |
Example Request
{
"id": "abc123"
}
Example Response
{
"id": "abc123",
"description": "String helpers #go #utility",
"public": false,
"files": [
{
"filename": "strings.go",
"language": "Go",
"content": "package strings\n\nfunc Reverse(s string) string {\n\t...\n}",
"size": 256,
"truncated": false
}
],
"html_url": "https://gist.github.com/user/abc123",
"created_at": "2025-01-10T08:00:00Z",
"updated_at": "2025-01-15T10:00:00Z"
}
create_snippet
Create a new code snippet (GitHub Gist).
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
description | string | no | Snippet description (include #tags here) |
public | boolean | no | Make public (default: false) |
files | array | yes | Files to include |
Each file in the files array:
| Field | Type | Required | Description |
|---|---|---|---|
filename | string | yes | Name of the file |
content | string | yes | File contents |
Example Request
{
"description": "HTTP client helper #go #http",
"public": false,
"files": [
{
"filename": "client.go",
"content": "package http\n\nimport \"net/http\"\n\nfunc Get(url string) (*http.Response, error) {\n\treturn http.Get(url)\n}"
}
]
}
Example Response
{
"id": "def456",
"description": "HTTP client helper #go #http",
"html_url": "https://gist.github.com/user/def456"
}
update_snippet
Update an existing snippet.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id | string | yes | Snippet ID to update |
description | string | no | New description |
files | array | no | Files to add or update |
remove_files | array | no | Filenames to remove |
Example Request
Update description and file content:
{
"id": "abc123",
"description": "Updated string helpers #go #utility #strings",
"files": [
{
"filename": "strings.go",
"content": "// Updated content\npackage strings\n\nfunc Reverse(s string) string {\n\trunes := []rune(s)\n\tfor i, j := 0, len(runes)-1; i < j; i, j = i+1, j-1 {\n\t\trunes[i], runes[j] = runes[j], runes[i]\n\t}\n\treturn string(runes)\n}"
}
]
}
Remove a file:
{
"id": "abc123",
"remove_files": ["old_file.txt"]
}
Example Response
{
"id": "abc123",
"description": "Updated string helpers #go #utility #strings",
"html_url": "https://gist.github.com/user/abc123"
}
delete_snippet
Permanently delete a snippet.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id | string | yes | Snippet ID to delete |
confirm | boolean | yes | Must be true to confirm deletion |
The confirm parameter prevents accidental deletions.
Example Request
{
"id": "abc123",
"confirm": true
}
Example Response
{
"deleted": true,
"id": "abc123"
}
Hashtag Tagging
GitHub Gists don’t natively support tags. Snippets-mcp extracts hashtags from the description field.
Format
Include hashtags in your description:
API client for GitHub #go #api #http
Rules
- Tags start with
#followed by a letter - Can contain letters, numbers, underscores, and hyphens
- Case-insensitive:
#Go,#GO,#goare equivalent - Issue references like
#123are ignored
Filtering
Use the tag parameter without the #:
{"tag": "go"}
This matches any snippet with #go, #Go, or #GO in its description.