Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

feat(skills): add body paging to skill-get to recover truncated bodies (#71425)

posthog[bot]177f626da95f
diff --git a/products/signals/backend/scout_harness/prompt.py b/products/signals/backend/scout_harness/prompt.py
index 93dafccf69f6..f2a37ef2c3b9 100644
--- a/products/signals/backend/scout_harness/prompt.py
+++ b/products/signals/backend/scout_harness/prompt.py
@@ -450,6 +450,8 @@ Pin to v{skill.version} explicitly — the run row, your tool resolution, and yo
The body tells you what to investigate, in what order, with what hypotheses. Pull files on demand with `skill-file-get` only when the body references them. Don't start investigating before you've read it.
+If the `body` you get back is shorter than the response's `body_total_length`, it was truncated in transit — page through the rest with `body_offset`/`body_length` and keep fetching from `body_next_offset` until it comes back null, so you read the whole procedure and don't start on a partial one.
+
# Then: orient on this project
Once you've read your skill, call:
diff --git a/products/skills/backend/api/skill_serializers.py b/products/skills/backend/api/skill_serializers.py
index 16c4298c8b2f..423f7aded23d 100644
--- a/products/skills/backend/api/skill_serializers.py
+++ b/products/skills/backend/api/skill_serializers.py
@@ -20,6 +20,8 @@ RESERVED_SKILL_NAMES = {"new", "scouts", "review-hog"}
# tree / plugin marketplace (the rendered SKILL.md). Compared case-insensitively.
RESERVED_SKILL_FILE_PATHS = {"skill.md"}
DEFAULT_VERSION_PAGE_SIZE = 50
+# Body-paging metadata is meaningless without the body, so the list serializer drops it alongside body/files.
+_LIST_EXCLUDED_FIELDS = ("body", "body_total_length", "body_next_offset", "files")
MAX_SKILL_BODY_BYTES = 1_000_000
MAX_SKILL_FILE_BYTES = 1_000_000
MAX_SKILL_FILE_COUNT = 50
@@ -112,6 +114,25 @@ class LLMSkillFetchQuerySerializer(serializers.Serializer):
)
+class LLMSkillBodyFetchQuerySerializer(LLMSkillFetchQuerySerializer):
+ """Fetch-by-name query params plus optional body paging — only the body-returning endpoint uses these."""
+
+ body_offset = serializers.IntegerField(
+ min_value=0,
+ required=False,
+ help_text="Zero-based character offset to start the returned body from. Use with body_length to page through a "
+ "large body that a client would otherwise truncate. Compare the returned body length against body_total_length "
+ "to detect truncation, then re-fetch from body_next_offset. Defaults to 0 (start of body).",
+ )
+ body_length = serializers.IntegerField(
+ min_value=1,
+ required=False,
+ help_text="Maximum number of characters of the body to return starting at body_offset. Omit to return the "
+ "whole body from the offset onwards. When the slice stops before the end, body_next_offset is the offset to "
+ "request next.",
+ )
+
+
class LLMSkillListQuerySerializer(serializers.Serializer):
search = serializers.CharField(
required=False,
@@ -352,6 +373,14 @@ class LLMSkillSerializer(serializers.ModelSerializer):
outline = serializers.SerializerMethodField(
help_text="Flat list of markdown headings parsed from the skill body. Useful as a lightweight table of contents.",
)
+ body_total_length = serializers.SerializerMethodField(
+ help_text="Total length of the full body in characters, independent of any body_offset/body_length paging. "
+ "Compare against the length of the returned body to detect a truncated response.",
+ )
+ body_next_offset = serializers.SerializerMethodField(
+ help_text="When body_length paging stops before the end of the body, the character offset to request next "
+ "(pass as body_offset). Null when the returned body reaches the end.",
+ )
class Meta:
model = LLMSkill
@@ -359,6 +388,10 @@ class LLMSkillSerializer(serializers.ModelSerializer):
"id",
"name",
"description",
+ # Body-paging metadata is ordered before `body` so it survives a client that
+ # truncates the tail of a large response — the truncation signal stays readable.
+ "body_total_length",
+ "body_next_offset",
"body",
"license",
"compatibility",
@@ -381,6 +414,8 @@ class LLMSkillSerializer(serializers.ModelSerializer):
"id",
"files",
"outline",
+ "body_total_length",
+ "body_next_offset",
"version",
"created_by",
"created_at",
@@ -429,6 +464,35 @@ class LLMSkillSerializer(serializers.ModelSerializer):
def get_outline(self, instance: LLMSkill) -> list[dict[str, Any]]:
return get_markdown_outline(instance.body)
+ def _body_offset(self) -> int:
+ return self.context.get("body_offset") or 0
+
+ @extend_schema_field(serializers.IntegerField())
+ def get_body_total_length(self, instance: LLMSkill) -> int:
+ return len(instance.body or "")
+
+ @extend_schema_field(serializers.IntegerField(allow_null=True))
+ def get_body_next_offset(self, instance: LLMSkill) -> int | None:
+ body_length = self.context.get("body_length")
+ if body_length is None:
+ return None
+ end = self._body_offset() + body_length
+ total = len(instance.body or "")
+ return end if end < total else None
+
+ def to_representation(self, instance: LLMSkill) -> dict[str, Any]:
+ data = super().to_representation(instance)
+ # Slice the body only when the caller asked to page through it — an ordinary
+ # fetch (no paging params) returns the whole body unchanged.
+ body = data.get("body")
+ if body is not None:
+ offset = self._body_offset()
+ body_length = self.context.get("body_length")
+ if offset or body_length is not None:
+ end = None if body_length is None else offset + body_length
+ data["body"] = body[offset:end]
+ return data
+
def validate_name(self, value: str) -> str:
return validate_skill_name_value(value)
@@ -503,8 +567,8 @@ class LLMSkillListSerializer(LLMSkillSerializer):
"""List serializer that omits body and file manifest — progressive disclosure (Level 1)."""
class Meta(LLMSkillSerializer.Meta):
- fields = [f for f in LLMSkillSerializer.Meta.fields if f not in ("body", "files")]
- read_only_fields = [f for f in LLMSkillSerializer.Meta.read_only_fields if f not in ("body", "files")]
+ fields = [f for f in LLMSkillSerializer.Meta.fields if f not in _LIST_EXCLUDED_FIELDS]
+ read_only_fields = [f for f in LLMSkillSerializer.Meta.read_only_fields if f not in _LIST_EXCLUDED_FIELDS]
class LLMSkillVersionSummarySerializer(serializers.ModelSerializer):
diff --git a/products/skills/backend/api/skills.py b/products/skills/backend/api/skills.py
index 6f1a84108f11..0f99a33a01bf 100644
--- a/products/skills/backend/api/skills.py
+++ b/products/skills/backend/api/skills.py
@@ -44,6 +44,7 @@ from ..marketplace.packaging import SkillImportError, build_skill_zip, parse_ski
from ..models.skills import LLMSkill, LLMSkillFile
from .skill_serializers import (
MAX_SKILL_FILE_BYTES,
+ LLMSkillBodyFetchQuerySerializer,
LLMSkillCreateSerializer,
LLMSkillDuplicateSerializer,
LLMSkillFetchQuerySerializer,
@@ -244,8 +245,13 @@ class LLMSkillViewSet(
)
return None
- def _serialize_skill(self, skill: LLMSkill) -> dict[str, Any]:
- return cast(dict[str, Any], LLMSkillSerializer(skill, context=self.get_serializer_context()).data)
+ def _serialize_skill(
+ self, skill: LLMSkill, *, body_offset: int | None = None, body_length: int | None = None
+ ) -> dict[str, Any]:
+ context = self.get_serializer_context()
+ if body_offset is not None or body_length is not None:
+ context = {**context, "body_offset": body_offset, "body_length": body_length}
+ return cast(dict[str, Any], LLMSkillSerializer(skill, context=context).data)
def _serialize_version_summaries(self, skills: list[LLMSkill]) -> list[dict[str, Any]]:
return cast(list[dict[str, Any]], LLMSkillVersionSummarySerializer(skills, many=True).data)
@@ -255,6 +261,11 @@ class LLMSkillViewSet(
serializer.is_valid(raise_exception=True)
return serializer.validated_data
+ def _get_body_fetch_params(self, request: Request) -> dict[str, Any]:
+ serializer = LLMSkillBodyFetchQuerySerializer(data=request.query_params)
+ serializer.is_valid(raise_exception=True)
+ return serializer.validated_data
+
def _get_resolve_query_params(self, request: Request) -> dict[str, Any]:
serializer = LLMSkillResolveQuerySerializer(data=request.query_params)
serializer.is_valid(raise_exception=True)
@@ -313,14 +324,14 @@ class LLMSkillViewSet(
)
@extend_schema(
- parameters=[LLMSkillFetchQuerySerializer],
+ parameters=[LLMSkillBodyFetchQuerySerializer],
responses={200: LLMSkillSerializer},
)
@action(methods=["GET"], detail=False, url_path=r"name/(?P<skill_name>[^/]+)")
@llma_track_latency("llma_skills_get_by_name")
@monitor(feature=None, endpoint="llma_skills_get_by_name", method="GET")
def get_by_name(self, request: Request, skill_name: str = "", **kwargs) -> Response:
- version_params = self._get_requested_version_params(request)
+ version_params = self._get_body_fetch_params(request)
version = cast(int | None, version_params.get("version"))
skill = get_skill_by_name_from_db(self.team, skill_name, version)
@@ -332,7 +343,13 @@ class LLMSkillViewSet(
if skill is None:
return self._skill_not_found_response(skill_name)
- return Response(self._serialize_skill(skill))
+ return Response(
+ self._serialize_skill(
+ skill,
+ body_offset=cast(int | None, version_params.get("body_offset")),
+ body_length=cast(int | None, version_params.get("body_length")),
+ )
+ )
def _redirect_to_name(self, request: Request, skill_name: str) -> Response | None:
skill_by_id = get_active_skill_queryset(self.team).filter(id=skill_name).first()
diff --git a/products/skills/backend/api/test/test_skills.py b/products/skills/backend/api/test/test_skills.py
index c0a9ac877f28..f1f38e92ee80 100644
--- a/products/skills/backend/api/test/test_skills.py
+++ b/products/skills/backend/api/test/test_skills.py
@@ -255,6 +255,8 @@ class TestLLMSkillAPI(APIBaseTest):
assert len(results) == 2
assert all("description" in r for r in results)
assert all("body" not in r for r in results)
+ # Body-paging metadata is meaningless without the body — it must not leak into the list.
+ assert all("body_total_length" not in r and "body_next_offset" not in r for r in results)
def test_list_skills_search_by_name(self):
self.create_skill(name="pdf-processing", description="Handles PDFs.")
@@ -345,6 +347,43 @@ class TestLLMSkillAPI(APIBaseTest):
assert data["body"] == "# Fetch me body"
assert "files" in data
+ def test_get_skill_by_name_reports_body_total_length_without_paging(self):
+ self.create_skill(name="whole-body", body="0123456789")
+
+ data = self.client.get(self._url("name/whole-body")).json()
+
+ assert data["body"] == "0123456789"
+ assert data["body_total_length"] == 10
+ # Without paging params the whole body is returned, so there is nothing left to fetch.
+ assert data["body_next_offset"] is None
+
+ @parameterized.expand(
+ [
+ # label, query, expected_body, expected_next_offset
+ ("first_page_has_more", "?body_offset=0&body_length=4", "0123", 4),
+ ("middle_page_has_more", "?body_offset=4&body_length=3", "456", 7),
+ ("last_page_exact_end", "?body_offset=8&body_length=2", "89", None),
+ ("length_past_end", "?body_offset=8&body_length=50", "89", None),
+ ("offset_only_returns_remainder", "?body_offset=7", "789", None),
+ ]
+ )
+ def test_get_skill_by_name_pages_through_body(self, _label, query, expected_body, expected_next_offset):
+ self.create_skill(name="paged-body", body="0123456789")
+
+ data = self.client.get(self._url(f"name/paged-body{query}")).json()
+
+ assert data["body"] == expected_body
+ # Total always reflects the full body, so a client can detect a truncated response.
+ assert data["body_total_length"] == 10
+ assert data["body_next_offset"] == expected_next_offset
+
+ def test_get_skill_by_name_rejects_negative_body_offset(self):
+ self.create_skill(name="bad-offset", body="hello")
+
+ response = self.client.get(self._url("name/bad-offset?body_offset=-1"))
+
+ assert response.status_code == status.HTTP_400_BAD_REQUEST
+
def test_get_skill_by_name_returns_file_manifest(self):
skill = self.create_skill(name="with-files")
LLMSkillFile.objects.create(skill=skill, path="scripts/setup.sh", content="#!/bin/bash\necho hi")
diff --git a/products/skills/frontend/LLMSkillScene.stories.tsx b/products/skills/frontend/LLMSkillScene.stories.tsx
index a9dc3c8ae1df..031f098c520a 100644
--- a/products/skills/frontend/LLMSkillScene.stories.tsx
+++ b/products/skills/frontend/LLMSkillScene.stories.tsx
@@ -62,6 +62,8 @@ const SKILL: LLMSkillApi = {
name: SKILL_NAME,
description: 'Extract text from PDFs, fill forms, and merge files. Use when handling PDFs.',
body: SKILL_BODY,
+ body_total_length: SKILL_BODY.length,
+ body_next_offset: null,
license: 'Apache-2.0',
compatibility: 'Requires poppler-utils on the host',
allowed_tools: ['read', 'shell'],
diff --git a/products/skills/frontend/generated/api.schemas.ts b/products/skills/frontend/generated/api.schemas.ts
index 7fc1774cabef..636995d4b7ee 100644
--- a/products/skills/frontend/generated/api.schemas.ts
+++ b/products/skills/frontend/generated/api.schemas.ts
@@ -166,6 +166,13 @@ export interface LLMSkillCreateApi {
* @maxLength 4096
*/
description: string
+ /** Total length of the full body in characters, independent of any body_offset/body_length paging. Compare against the length of the returned body to detect a truncated response. */
+ readonly body_total_length: number
+ /**
+ * When body_length paging stops before the end of the body, the character offset to request next (pass as body_offset). Null when the returned body reaches the end.
+ * @nullable
+ */
+ readonly body_next_offset: number | null
/** The SKILL.md instruction content (markdown). */
body: string
/**
@@ -228,6 +235,13 @@ export interface LLMSkillApi {
* @maxLength 4096
*/
description: string
+ /** Total length of the full body in characters, independent of any body_offset/body_length paging. Compare against the length of the returned body to detect a truncated response. */
+ readonly body_total_length: number
+ /**
+ * When body_length paging stops before the end of the body, the character offset to request next (pass as body_offset). Null when the returned body reaches the end.
+ * @nullable
+ */
+ readonly body_next_offset: number | null
/** The SKILL.md instruction content (markdown). */
body: string
/**
@@ -485,6 +499,16 @@ export type LlmSkillsListParams = {
}
export type LlmSkillsNameRetrieveParams = {
+ /**
+ * Maximum number of characters of the body to return starting at body_offset. Omit to return the whole body from the offset onwards. When the slice stops before the end, body_next_offset is the offset to request next.
+ * @minimum 1
+ */
+ body_length?: number
+ /**
+ * Zero-based character offset to start the returned body from. Use with body_length to page through a large body that a client would otherwise truncate. Compare the returned body length against body_total_length to detect truncation, then re-fetch from body_next_offset. Defaults to 0 (start of body).
+ * @minimum 0
+ */
+ body_offset?: number
/**
* Specific skill version to fetch. If omitted, the latest version is returned.
* @minimum 1
diff --git a/products/skills/frontend/llmSkillLogic.ts b/products/skills/frontend/llmSkillLogic.ts
index d142fe3bdfdc..b6d7a8eef305 100644
--- a/products/skills/frontend/llmSkillLogic.ts
+++ b/products/skills/frontend/llmSkillLogic.ts
@@ -771,6 +771,8 @@ export const llmSkillLogic = kea<llmSkillLogicType>([
const paddedSkill: ResolvedLLMSkill = {
...existingSkill,
body: '',
+ body_total_length: 0,
+ body_next_offset: null,
files: [],
versions: [],
has_more: false,
diff --git a/products/skills/mcp/tools.yaml b/products/skills/mcp/tools.yaml
index 0dcc95411496..3604229dd532 100644
--- a/products/skills/mcp/tools.yaml
+++ b/products/skills/mcp/tools.yaml
@@ -140,9 +140,12 @@ tools:
title: Get skill
description: >
Get a specific agent skill by name, including its full body content, metadata, and file manifest. Follows
- the Agent Skills specification (agentskills.io). To link a user to this skill in the PostHog app, build the
- URL from the skill `name`, not its `id`: `/llm-analytics/skills/<name>` (e.g.
- `/llm-analytics/skills/pr-shepherd`). The `id` (UUID) is not a valid route segment and will 404.
+ the Agent Skills specification (agentskills.io). The response always includes body_total_length (the full
+ body length in characters) — if the body you received is shorter than that, it was truncated in transit, so
+ page through it with body_offset and body_length and continue from body_next_offset until it is null. To
+ link a user to this skill in the PostHog app, build the URL from the skill `name`, not its `id`:
+ `/llm-analytics/skills/<name>` (e.g. `/llm-analytics/skills/pr-shepherd`). The `id` (UUID) is not a valid
+ route segment and will 404.
skill-list:
operation: llm_skills_list
enabled: true
diff --git a/services/mcp/schema/generated-tool-definitions.json b/services/mcp/schema/generated-tool-definitions.json
index 24bc0016663a..c8c87237b701 100644
--- a/services/mcp/schema/generated-tool-definitions.json
+++ b/services/mcp/schema/generated-tool-definitions.json
@@ -7798,7 +7798,7 @@
}
},
"skill-get": {
- "description": "Get a specific agent skill by name, including its full body content, metadata, and file manifest. Follows the Agent Skills specification (agentskills.io). To link a user to this skill in the PostHog app, build the URL from the skill `name`, not its `id`: `/llm-analytics/skills/<name>` (e.g. `/llm-analytics/skills/pr-shepherd`). The `id` (UUID) is not a valid route segment and will 404.",
+ "description": "Get a specific agent skill by name, including its full body content, metadata, and file manifest. Follows the Agent Skills specification (agentskills.io). The response always includes body_total_length (the full body length in characters) — if the body you received is shorter than that, it was truncated in transit, so page through it with body_offset and body_length and continue from body_next_offset until it is null. To link a user to this skill in the PostHog app, build the URL from the skill `name`, not its `id`: `/llm-analytics/skills/<name>` (e.g. `/llm-analytics/skills/pr-shepherd`). The `id` (UUID) is not a valid route segment and will 404.",
"category": "Skills",
"feature": "skills",
"summary": "Get skill",
diff --git a/services/mcp/schema/tool-definitions-all.json b/services/mcp/schema/tool-definitions-all.json
index 629374ff95d7..9a409fb59d7f 100644
--- a/services/mcp/schema/tool-definitions-all.json
+++ b/services/mcp/schema/tool-definitions-all.json
@@ -8306,7 +8306,7 @@
}
},
"skill-get": {
- "description": "Get a specific agent skill by name, including its full body content, metadata, and file manifest. Follows the Agent Skills specification (agentskills.io). To link a user to this skill in the PostHog app, build the URL from the skill `name`, not its `id`: `/llm-analytics/skills/<name>` (e.g. `/llm-analytics/skills/pr-shepherd`). The `id` (UUID) is not a valid route segment and will 404.",
+ "description": "Get a specific agent skill by name, including its full body content, metadata, and file manifest. Follows the Agent Skills specification (agentskills.io). The response always includes body_total_length (the full body length in characters) — if the body you received is shorter than that, it was truncated in transit, so page through it with body_offset and body_length and continue from body_next_offset until it is null. To link a user to this skill in the PostHog app, build the URL from the skill `name`, not its `id`: `/llm-analytics/skills/<name>` (e.g. `/llm-analytics/skills/pr-shepherd`). The `id` (UUID) is not a valid route segment and will 404.",
"category": "Skills",
"feature": "skills",
"summary": "Get skill",
diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.ts
index cf9ed5a487bc..3d50171593f2 100644
--- a/services/mcp/src/api/generated.ts
+++ b/services/mcp/src/api/generated.ts
@@ -33094,6 +33094,13 @@ export namespace Schemas {
* @maxLength 4096
*/
description: string;
+ /** Total length of the full body in characters, independent of any body_offset/body_length paging. Compare against the length of the returned body to detect a truncated response. */
+ readonly body_total_length: number;
+ /**
+ * When body_length paging stops before the end of the body, the character offset to request next (pass as body_offset). Null when the returned body reaches the end.
+ * @nullable
+ */
+ readonly body_next_offset: number | null;
/** The SKILL.md instruction content (markdown). */
body: string;
/**
@@ -33162,6 +33169,13 @@ export namespace Schemas {
* @maxLength 4096
*/
description: string;
+ /** Total length of the full body in characters, independent of any body_offset/body_length paging. Compare against the length of the returned body to detect a truncated response. */
+ readonly body_total_length: number;
+ /**
+ * When body_length paging stops before the end of the body, the character offset to request next (pass as body_offset). Null when the returned body reaches the end.
+ * @nullable
+ */
+ readonly body_next_offset: number | null;
/** The SKILL.md instruction content (markdown). */
body: string;
/**
@@ -67877,6 +67891,16 @@ export namespace Schemas {
};
export type EnvironmentsLlmSkillsNameRetrieveParams = {
+ /**
+ * Maximum number of characters of the body to return starting at body_offset. Omit to return the whole body from the offset onwards. When the slice stops before the end, body_next_offset is the offset to request next.
+ * @minimum 1
+ */
+ body_length?: number;
+ /**
+ * Zero-based character offset to start the returned body from. Use with body_length to page through a large body that a client would otherwise truncate. Compare the returned body length against body_total_length to detect truncation, then re-fetch from body_next_offset. Defaults to 0 (start of body).
+ * @minimum 0
+ */
+ body_offset?: number;
/**
* Specific skill version to fetch. If omitted, the latest version is returned.
* @minimum 1
@@ -75495,6 +75519,16 @@ export namespace Schemas {
};
export type LlmSkillsNameRetrieveParams = {
+ /**
+ * Maximum number of characters of the body to return starting at body_offset. Omit to return the whole body from the offset onwards. When the slice stops before the end, body_next_offset is the offset to request next.
+ * @minimum 1
+ */
+ body_length?: number;
+ /**
+ * Zero-based character offset to start the returned body from. Use with body_length to page through a large body that a client would otherwise truncate. Compare the returned body length against body_total_length to detect truncation, then re-fetch from body_next_offset. Defaults to 0 (start of body).
+ * @minimum 0
+ */
+ body_offset?: number;
/**
* Specific skill version to fetch. If omitted, the latest version is returned.
* @minimum 1
diff --git a/services/mcp/src/generated/skills/api.ts b/services/mcp/src/generated/skills/api.ts
index e13d31a720b4..b4802fd741a1 100644
--- a/services/mcp/src/generated/skills/api.ts
+++ b/services/mcp/src/generated/skills/api.ts
@@ -133,7 +133,23 @@ export const LlmSkillsNameRetrieveParams = /* @__PURE__ */ zod.object({
skill_name: zod.string().regex(llmSkillsNameRetrievePathSkillNameRegExp),
})
+export const llmSkillsNameRetrieveQueryBodyOffsetMin = 0
+
export const LlmSkillsNameRetrieveQueryParams = /* @__PURE__ */ zod.object({
+ body_length: zod
+ .number()
+ .min(1)
+ .optional()
+ .describe(
+ 'Maximum number of characters of the body to return starting at body_offset. Omit to return the whole body from the offset onwards. When the slice stops before the end, body_next_offset is the offset to request next.'
+ ),
+ body_offset: zod
+ .number()
+ .min(llmSkillsNameRetrieveQueryBodyOffsetMin)
+ .optional()
+ .describe(
+ 'Zero-based character offset to start the returned body from. Use with body_length to page through a large body that a client would otherwise truncate. Compare the returned body length against body_total_length to detect truncation, then re-fetch from body_next_offset. Defaults to 0 (start of body).'
+ ),
version: zod
.number()
.min(1)
diff --git a/services/mcp/src/tools/generated/skills.ts b/services/mcp/src/tools/generated/skills.ts
index 9052978b6bf7..8bdf52a0c2e3 100644
--- a/services/mcp/src/tools/generated/skills.ts
+++ b/services/mcp/src/tools/generated/skills.ts
@@ -218,6 +218,8 @@ const skillGet = (): ToolBase<typeof SkillGetSchema, Schemas.LLMSkill> => ({
method: 'GET',
path: `/api/projects/${encodeURIComponent(String(projectId))}/llm_skills/name/${encodeURIComponent(String(params.skill_name))}/`,
query: {
+ body_length: params.body_length,
+ body_offset: params.body_offset,
version: params.version,
},
})
diff --git a/services/mcp/tests/integration/manifest.test.ts b/services/mcp/tests/integration/manifest.integration.test.ts
similarity index 63%
rename from services/mcp/tests/integration/manifest.test.ts
rename to services/mcp/tests/integration/manifest.integration.test.ts
index d992fc1fb111..210bfde806bc 100644
--- a/services/mcp/tests/integration/manifest.test.ts
+++ b/services/mcp/tests/integration/manifest.integration.test.ts
@@ -1,6 +1,6 @@
import { describe, expect, it } from 'vitest'
-import { fetchContextMillResources, loadManifestFromArchive } from '@/resources/internals'
+import { fetchContextMillResources, filterValidEntries, loadManifestFromArchive } from '@/resources/internals'
describe('Context-Mill Manifest Integration', () => {
it('should fetch, unzip, and validate the manifest from GitHub releases', async () => {
@@ -19,8 +19,14 @@ describe('Context-Mill Manifest Integration', () => {
// Verify we have actual resources
expect(validatedManifest.resources.length).toBeGreaterThan(0)
- // Verify each resource has required fields and its file exists in archive
- for (const entry of validatedManifest.resources) {
+ // The MCP server serves entries via filterValidEntries, which drops any entry
+ // whose backing file is missing from the archive. Validate the resources as
+ // actually served rather than asserting every manifest file is bundled.
+ const servedEntries = filterValidEntries(validatedManifest.resources, archive)
+ expect(servedEntries.length).toBeGreaterThan(0)
+
+ // Verify each served resource has required fields and its file exists in archive
+ for (const entry of servedEntries) {
expect(entry.id).toBeTruthy()
expect(entry.name).toBeTruthy()
expect(entry.resource).toBeTruthy()
diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/llma-skill-get.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/llma-skill-get.json
index ed1bb018c7d8..db03f1484154 100644
--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/llma-skill-get.json
+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/llma-skill-get.json
@@ -1,6 +1,16 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"properties": {
+ "body_length": {
+ "description": "Maximum number of characters of the body to return starting at body_offset. Omit to return the whole body from the offset onwards. When the slice stops before the end, body_next_offset is the offset to request next.",
+ "minimum": 1,
+ "type": "number"
+ },
+ "body_offset": {
+ "description": "Zero-based character offset to start the returned body from. Use with body_length to page through a large body that a client would otherwise truncate. Compare the returned body length against body_total_length to detect truncation, then re-fetch from body_next_offset. Defaults to 0 (start of body).",
+ "minimum": 0,
+ "type": "number"
+ },
"skill_name": {
"pattern": "^[^/]+$",
"type": "string"
diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/skill-get.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/skill-get.json
index ed1bb018c7d8..db03f1484154 100644
--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/skill-get.json
+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/skill-get.json
@@ -1,6 +1,16 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"properties": {
+ "body_length": {
+ "description": "Maximum number of characters of the body to return starting at body_offset. Omit to return the whole body from the offset onwards. When the slice stops before the end, body_next_offset is the offset to request next.",
+ "minimum": 1,
+ "type": "number"
+ },
+ "body_offset": {
+ "description": "Zero-based character offset to start the returned body from. Use with body_length to page through a large body that a client would otherwise truncate. Compare the returned body length against body_total_length to detect truncation, then re-fetch from body_next_offset. Defaults to 0 (start of body).",
+ "minimum": 0,
+ "type": "number"
+ },
"skill_name": {
"pattern": "^[^/]+$",
"type": "string"